Check_MK has the ability to export performance data to a Graphite / Grafana server in real time. This allows us to build advanced views and dashboards to visualize the service check data coming out of Check_MK.
In this tutorial we will walk through the process of setting up Check_MK to export performance data to InfluxDB which will act as a Graphite collector and how to get started with Grafana by creating a dashboard to show traffic through a few switch ports.
For this demo, I am using Check_MK 1.4.0p8 Enterprise and InfluxDB 1.3.5.
The first thing we need to do is to install InfluxDB. Go ahead and grab the latest release.
Once InfluxDB is installed, open /etc/influxdb/influxdb.conf with your favorite editor and navigate to a section called [[graphite]].
We are going to set enabled to true and set the database name. In this case, I kept it to the default graphite.
Restart InfluxDB and confirm graphite is listening. (Default port is 2003)
In WATO, navigate to Global Settings > Monitoring Core > Send metrics to Graphite / InfluxDB
Fill out the IP of your InfluxDB instance, and save the configuration.
Check_MK should now be sending information to InfluxDB after every polling period. We can confirm this by looking back at our database to see if there are any new entries.
There are now "tables" for every metric that Check_MK collects.
Inside each of these tables are key/value entries with timestamps.
In our case, there is only one key called "value".
With a simple query we can see the values that Check_MK is reporting.
select "value" from "multiplex_genesee_om2_io.Interface_00001.out"
Create a Dashboard
Next, we need to install Grafana.
Grab the latest version from the website or install the repository for easy updating.
Once Grafana is installed, navigate to the web interface. By default this is on port 3000.
The default username and password is admin and admin respectively.
The first thing we need to do in Grafana is set up a data source.
We will set the type to InfluxDB and point the URL to the InfluxDB HTTP API.
Set your database to the name you configured in part 1.
By default the username and password are admin and admin respectively.
Now that the data source is set up we can create some graphs on a dashboard.
Here I have made two simple queries, one for input bandwidth and one for output.
You can see the raw query for output bandwidth. $timeFilter is a Grafana specific variable that will be filled out for the time range that is set.
It is important to note that Grafana does not know what what kind of units to use for the data it receives. This should be manually specified. Check_MK happens to export interface bandwidth in Bytes per second, so the "Y" axis units need to be changed under the "Axes" tab.
We can now extend this graphing to additional hosts and services as well as build customized dashboards to show data from multiple key hosts simultaneously. The possibilities are limited only by your imagination. If you want to know more, or would like us to assist with your organization's deployment of Check_MK and Grafana, please reach out and Contact TruePath.