Grafana alerts as datasource


#1

Hi, I need to display a world map showing Grafana alarms. The goal is to show the alarm state and the geographic location on a map to quickly get an overview for customers with a lot of different locations.

Initially I started modifying the worldmap plugin to work with grafana alerts, but I think having alerts as a datasource would be a better approach. It could then be used for several purposes such as a trend showing state changes over time.

Has anybody done something similar before?


#2

If you are using MySQL as your database then you could use the MySQL data source to achieve this if you use the current nightly build (version 4.5 should be released today or tomorrow and it includes the MySQL plugin).

Another option is to create a back end to the Simple JSON data source and use the Grafana API to fetch the current alerts (unfortunately we have no api endpoint for alert history).

It might also be hard to connect an alert to a geographic location (that is also on our todo list). It would absolutely be possible to make a data source for this but it is not on our current road map.


#3

Thanks for your reply. I’m using the influxDB as my datasource.

Currently we have made a webhook server which puts all alarms from Grafana into an alarm database in influx. The location data is inputted in the alarm message so the user can set location from Grafana.

We need to alarm history so I think well stick with the webhook approach instead of simple JSON data source for now.

Is the alert API as a datasource a feature request I could add on github?


#4

Yes, absolutely - open a feature request.