I wanted to have a brief overview of my sites in Grafana showing info is the site is up or down. This might seem like an easy thing to do but it turned out to be more difficult as you might think. However I wanted to share how to do this. My way.
To make this work I have used the components below.
Check MK (My monitor solution that sends data to Graphite)
Grafana (With the Graphite datasource, the new stat panel and boomtheme plugin)
Graphite (the database)
You could use any other software providing ping checks. Like Prometheus. First of all we also might think about what makes a host being up or down. In my case we are using ping packet loss to check this to a switch. However the switch might reply but could be damaged in other ways. The hosts behind the switch could be offline, the cables might be disconnected somehow or something different. Anyway, In this case we are just using ping pl and if the pl is not high we consider the host as up.
First create an empty dashboard i Grafana. Add a new stat panel like below. Choose any host you want. Choose ping and pl as a service. Depending of your data source the layout might not look the same. In my case I had to use Graphite as the Check MK native datasource does not provide offset.
Under functions add offset(1). Why? Because we will get a value of ping pl 100% if the host is down. This is fine. However if the host is up we will not get any value at all. This is why we add 1.
Now check the settings for the statpanel. Use calculation Last (not null). And choose the other settings like in the image. Also set range on value mappings. From 95 to 101 (we added one value so it must be 101). Type Down or whatever you want to. If the ping pl is high now the host will be red. Also add the range from 1 to 95 and type Up. This will make the image green and Up if the ping pl is low.
Clone the hosts.
The final thing I did was to add the Boom Theme. This is quite useless but will add a background image to your dashboard. This might look nice when showing the dashboard on a TV.