grafana / worldmap-panel

Worldmap panel plugin for Grafana 3.0 that can be overlaid with circles for data points.
MIT License
311 stars 199 forks source link

Add support of zabbix datasource #40

Open floppy84 opened 8 years ago

floppy84 commented 8 years ago

Is it possible to add support of zabbix datasource for worldmap plugin ?

image

daniellee commented 8 years ago

Yes. First, I'll install Zabbix locally and check if it is possible to get it working without having to change the code.

queirozla commented 7 years ago

Is it possible to use Wordmap with Zabbix datasource ?

zircon2017 commented 7 years ago

Someone can explain how to manage the data from the database?

chl19940220 commented 7 years ago

I want to know how to manage the data from zabbix, too

daniellee commented 7 years ago

Related issue: https://github.com/alexanderzobnin/grafana-zabbix/issues/280

I couldn't find any country specific data from Zabbix in the metrics in the Zabbix data source (country codes, latitude, longitude etc.). Anyone got any hints on where to look?

robnavrey commented 7 years ago

You can find the info at the table host_inventory (location_lat and location_lon, that, if manually populated, should contain the latitude and longitude of the host location).

Deriuz commented 6 years ago

Hi @daniellee , any luck on this? I wanted this to present all of my firewalls across Asia. I'm having hard time searching the internet. Hope you have good news for us ;)

communig8-public commented 6 years ago

Hi all, I'm looking at this for an IoT project using the Electric Imp connected to a GPS Receiver. Without hitting too much detail, Zabbix picks up a geohash from the Imp so there is a Zabbix host item that holds the geohash not inventory data (which the Grafana Zabbix plugin does not support anyway). Another host item holds the temperature (from a temperature sensor connected to the IMP) as the "metric".

nikolasdequeiroz commented 6 years ago

Any news of this feature?

jameskirsop commented 6 years ago

Related issue: alexanderzobnin/grafana-zabbix#280

I couldn't find any country specific data from Zabbix in the metrics in the Zabbix data source (country codes, latitude, longitude etc.). Anyone got any hints on where to look?

The lat/long data is stored in inventory attributes against each host. The Zabbix API exposes these, but I'm not sure that alexanderzobnin/grafana-zabbix has support for exposing them to grafana.

I expect we'd need @alexanderzobnin (or someone else) to write a pull request to add support for exposing these inventory attributes to Grafana before we can get WorldMap to use the data.

As people have mentioned in the aforementioned issue, this data is directly available by querying the MySQL Database, if Zabbix is backed on to it - but that's not always the case. I think this needs to be put on the burner until we can get invent. data exposed in a usable way.

I think it would be possible to write some middleware to grab the lat/long/hostID and present that in a JSON file, and then merge that with the zabbix host data as an interim solution. I'll see if I can come up with something.

jameskirsop commented 6 years ago

An an update, I've created this project which allows for the creation of the necessary JSON data to provide host up/down status info to WorldMap. It's not exactly what everyone will need, but for me, it's a good temporary measure. PR's are welcome.

alexanderzobnin commented 5 years ago

I like this feature. Since zabbix has lat/long data and it's possible to get it from api it would be nice to have it in WorldMap. I'll open an issue for grafana-zabbix repo. I see few basic modes for this feature:

larsandre89 commented 5 years ago

@alexanderzobnin, getting this into grafana-zabbix would be awesome!

For my use case, we are having host groups in Zabbix, which are based locations. To be able to put them on to WorldMap, and show number of problems per host group will give us a much simpler overview of the status of our infrastructure!

pratickraj commented 5 years ago

Any updates @alexanderzobnin?

aissatm commented 5 years ago

Hi @alexanderzobnin It will be a very nice feature.

aalmarshad commented 4 years ago

is there any updates @alexanderzobnin?

amotl commented 4 years ago

Hi there,

we will be happy to accept respective pull requests against [1]. This repository got quite a bunch of improvements regarding robustness and features, some already collected from different pull requests from the community, see also [2].

With kind regards, Andreas.

[1] https://github.com/panodata/grafana-worldmap-panel [2] https://github.com/panodata/grafana-worldmap-panel/issues/20

glardz98 commented 4 years ago

hello,

is it possible to have a map with severity of each trigger ?

i have this sql request, that works, but when trigger is gone, le point in the map gone,

my $query="SELECT * FROM hosts LEFT JOIN hosts_groups ON (hosts.hostid = hosts_groups.hostid AND hosts.host NOT LIKE '%Template%') LEFT JOIN hstgrp ON (hstgrp.groupid = hosts_groups.groupid ) LEFT JOIN host_inventory ON (host_inventory.hostid = hosts.hostid) LEFT JOIN items i ON (i.hostid = hosts.hostid) INNER JOIN functions f ON (f.itemid = i.itemid) INNER JOIN triggers t ON (t.triggerid = f.triggerid AND t.value=1)

INNER JOIN problem pb ON (pb.objectid = t.triggerid)

INNER JOIN events e ON (e.objectid = t.triggerid)

GROUP BY hosts.hostid";

IslamAlam commented 4 years ago

I was able to create a workaround based on the previously proposed solution to make the panel show the severity colours based on Zabbix trigger severity values.

This JSON file includes the setup for the panel to work as expected.

DB Dashboard-1577043923027.zip

image

In the dashboard Queries add the following query for the database:

    SELECT  DISTINCT ON (h.host) --,inventory.location_lat, inventory.location_lon )
            h.host as host_name,
            max(t.priority) AS max_severity,
            inventory.location_lat AS "lat", 
            inventory.location_lon AS "lon"

    FROM    hosts AS h
            INNER JOIN items AS i
            ON ( i.hostid = h.hostid ) 
            INNER JOIN functions AS f
            ON ( f.itemid = i.itemid )
            INNER JOIN triggers AS t
            ON ( t.triggerid = f.triggerid ),
            host_inventory AS inventory

    WHERE  inventory.hostid=h.hostid AND inventory.location_lon!='' AND t.value!=0

    Group by h.host, inventory.location_lat, inventory.location_lon
    --ORDER BY h.host DESC--, inventory.location_lat, inventory.location_lon

This query for the database would return a table, which will be used for the world-panel-map for mapping it. Notice, the max_serviry here, it is the highest trigger value for each given host. image

In the visualization tab configure it as the following; image

I defined the colours for the trigger severity as the same colour code in Zabbix. image

IslamAlam commented 4 years ago

@glardz98 Yeah, it is possible to show the severity for each trigger check this solution: https://github.com/grafana/worldmap-panel/issues/40#issuecomment-568298842

aalmarshad commented 4 years ago

This is for PostgreSQL and will not work with mysql !

FCP-MattIT commented 3 years ago

I've got worldmap installed, and the appropriate firewall logs being fed into ES. I tried to setup the worldmap with geohash utilizing the source.geo.location field as it's got long/lat data. However, nothing shows up when building my query or in the worldmap.

image

Let me know if I'm missing something stupid.

QuackPhD commented 2 years ago

@FCP-MattIT

I've got worldmap installed, and the appropriate firewall logs being fed into ES. I tried to setup the worldmap with geohash utilizing the source.geo.location field as it's got long/lat data. However, nothing shows up when building my query or in the worldmap.

image

Let me know if I'm missing something stupid.

########################################################### I have written this up myself for MySQL Zabbix Instances, using Grafana.

CODE START

############ SELECT h.hostid, h.name, hi.location_lat, hi.location_lon, t.status, t.description, t.value FROM host_inventory as hi INNER JOIN hosts AS h ON (h.hostid = hi.hostid) INNER JOIN items AS i ON (i.hostid = h.hostid) INNER JOIN functions AS f ON (f.itemid = i.itemid) INNER JOIN triggers AS t ON (f.triggerid = t.triggerid) WHERE hi.hostid=h.hostid AND hi.location_lat!='' AND t.status=0 ORDER BY t.value asc ############

CODE END

If you want to add a text filter, add this to the end of the WHERE clause after the 0. Your text goes in between the wildcards (%) "AND t.description LIKE '%Offline%'"

############################## Grafana WorldMap Panel Settings Data Source: MySQL Format As: Table

Map Data Options Location Data: Table Aggregation: Current Table Query Format: Coordinates Location Name Field:name Metric Field: Value (0 = OK, 1 = Problem) Latitude Field: location_lat Longitude Field: location_lon Thresholds: 0 (0 = Green, 1 = Red)

Reference:https://www.zabbix.com/documentation/current/en/manual/api/reference/trigger/object

Hoping that helps someone out there. WorldMap