ZABBIX Map on Grafana

Hi Everyone

I created a map of all my switchs on ZABBIX, I istalled grafana to show metrics from zabbix, I created a dashbord for each switch, it’s great, but I want to display my map on grafa, and when i click on a switch i have access to its dashbord

1 Like

Hi! You can display your map in grafana using Grafana’s Text panel. Set mode to html and use your map url as image src, for instance:
<img src="http://zabbix.grafana-zabbix.org/map.php?noedit=1&sysmapid=1&width=&height=&curtime=1495181459&severity_min=0">

Or use markdown:
![mymap](http://zabbix.grafana-zabbix.org/map.php?noedit=1&sysmapid=1&width=&height=&curtime=1495181459&severity_min=0)

Unfortunately, Zabbix uses additional html layer with inks over png image and you cannot just click on the map and redirect to the particular address. You can only use links in panel drildown. or in panel description.
But also you can use this trick. Open your map in zabbix. Open browser dev tools and use selection tool to select map element. Then copy <div class="map-container"... element and past it into Text panel. Find <img> tag and add your zabbix server address to src:
src="map.php?... -> src="http://zabbix.grafana-zabbix.org/map.php?...
Done!

But links will point to zabbix maps, so you should edit it too if you need.

2 Likes

See example here:
http://play.grafana-zabbix.org/dashboard/db/zabbix-map-integration

Hello there,

I have been able to display a zabbix map in grafana but it seem the maps are not being refreshed automatically. I have set refesh at zabbix user level + refresh on dashbaord level . Still same…no referesh is hapenning.

Any way someone can enlight me …

Thanx

izn0g00d

would this work…seem not

head>

img src="http://192.168.100.6/zabbix/map.php?noedit=1&sysmapid=5&width=&height=&curtime=1496710901&severity_min=0"> /head>

i removea tag so u can see the code :slight_smile:

Hello, since Zabbix version 3.4 maps are in SVG format. Now if I open http://zabbixserver/map.php?noedit=1&sysmapid=1&width=&height=&curtime=1495181459&severity_min=0 the output is json like this:

{“mapid”:“1”,“canvas”:{“width”:“750”,“height”:“700”},“background”:“188”,“elements”:[],“links”:[],“shapes”:[{“sysmap_shapeid”:“0”,“type”:“0”,“x”:“0”,“y”:“0”,“width”:“680”,“height”:“15”,“border_type”:“0”,“border_width”:“0”,“border_color”:“000000”,“text”:“Local network”,“font”:“9”,“font_size”:“11”,“font_color”:“000000”,“text_halign”:“0”,“text_valign”:“0”,“background_color”:"",“zindex”:"-1"}],“label_location”:“0”,“timestamp”:“2017-11-08 23:38:35”}

This is blank map to there is not much data . How can I integrate maps into Grafana now that there is no more PNG images?

Thx
Regards

1 Like

Not sure. I want to create zabbix map panel for grafana, but it requires so much time to implement.

1 Like

Hi all -

We had similar issue pulling into our internal Wiki, once upgrading to Zabbix 3.4 (last month) we obviously broke the wget png file we were using from our Zabbix host(s). One of our in house guys wrote a quick script using js that we run from cron to pull maps every 5 minutes. Parsing the svg and creating the png to present within the wiki. I’m new to the Grafana community but would be happy to share if if requested - possibly a starting point to get a feature integration into the plugin?

Hi xponet (or whoever can assist),

Please share the script or any insights as I am in a similar bind.

Thanks

Hi. Any solution for Zabbix 4.0 and Grafana 5.4? :slight_smile:

FWIW I have been using crontab with a Phantomjs script to take a screenshot of the zabbix map(s), crop the image and save to a png file. Then use Grafana’s html text panel to display the image file created.

Thank you for answer!
Can you share this script if it is not incompatible with license?

Here you go, I used chrome’s page ruler extension to get the pixels on the map page:

var page = require(‘webpage’).create();

page.viewportSize = {
width: xxx,
height: xxx
};
page.open(‘ENTER URL HERE’, function() {
page.clipRect = { top: xx, left: xx, width: xxxx, height: xxx };
page.render(‘NEW FILE NAME’);
phantom.exit();
});

1 Like

Can someone help me?

I need to show a map I made on Zabbix in grafana.
zabbix version 4 and script version 5.4.

But I could not follow in the steps of alexanderzobnin, because it has no <div class = “map-container”, or I can not find it.

Try to read comments.

map integration successful?
I have same problemerrorJPG

To enable unsafe javascript execution in text panels enable the settings disable_sanitize_html under the section [panels] in your Grafana ini file, or set env variable GF_PANELS_DISABLE_SANITIZE_HTML=true.

automatically copied the code <div class = “map-container”
is it possible?
P/S map update occurs every 5 min

After upgrading my Zabbix to 4.0, my map stopped showing in Grafana. Is there any solution? I am using Grafana version 6.1.6 with the plugin version 3.10.5.