Graphing Zabbix Items with Grafana on CentOS 7

October 13, 2018

Grafana is a beautiful, open source tool that can be used to create dashboards filled with data that has been gathered by a multitude of sources.  For this demo, we'll graph some of the data that our Zabbix instance has collected.

Installation of Grafana

  1. First, we'll need to add the Grafana repo:
    [grafana]
    name=grafana
    baseurl=https://packagecloud.io/grafana/stable/el/7/$basearch
    repo_gpgcheck=1
    enabled=1
    gpgcheck=1
    gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
    sslverify=1
    sslcacert=/etc/pki/tls/certs/ca-bundle.crt
  2. Just like any other package, we can now go ahead and install Grafana:
    yum install grafana -y
  3. Let's enable Grafana on boot and start it now:
    systemctl enable grafana-server
    systemctl start grafana-server

Adding Zabbix as a Source

  1. First, we'll need to install the Zabbix datastore plugin:
    grafana-cli plugins install alexanderzobnin-zabbix-app
  2. We'll restart Grafana after the plugin's installation has been completed:
    systemctl restart grafana-server
  3. Login to your Grafana instance's web UI and hover over the gear button (left side, titled: Configuration).
  4. When the menu appears, click on Data Sources.
  5. Click on the Zabbix logo.
  6. A new page should appear that requires information such as the URL of your Zabbix instance and credentials. Here's what should be entered:
    • HTTP > URL: http://127.0.0.1/api_jsonrpc.php
    • Auth > With Credentials: Checked
    • Auth > Skip TLS Verification (Insecure): Checked (optional)
    • Zabbix API details > Username: Username of a service account that has access to all hosts
    • Zabbix API details > Password: Password of the service account used above.
  7. Lastly, click Save & Test.

Graphing Zabbix Items

  1. Now that we have Zabbix added as a datasource, let's create a new dashboard and add our first panel: Graph.
  2. The new page will automatically bring you to the Metrics tab. Select Zabbix as the data source and then pick a host and item to graph.
  3. Click the return button (top right, blue) to return to your newly created dashboard.

You should now have a beautiful, autogenerated graph of whatever Zabbix item you picked.  Grafana graphs are great for graphing items like CPU utilization or number of active VPN users, etc.

Graphing temperatures of a Juniper EX9208
Graphing number of users who are VPN'ed in

Also, keep in mind that there are multiple panels included (other than Graph) and that there are more available to download.

Status Map panel of a Juniper EX9208's fan status
Singlestat panel of CPU and RAM utilization of a Juniper EX9208's routing engines

The possibilities of data representation with Grafana and Zabbix are endless!


©2024 Tyler Wright