The PalmTree Network

Your money. Your time. Your future.

Connect Zabbix with Grafana

This section is part of Zabbix & Elrond Guide

WHY GRAFANA?

Grafana makes it really easy to create very visual and useful graphs and adapt them properly in awesome dashboards. Not only is it very visual, it has some really interesting filter functions if you have a huge number of nodes you can look at the worst 5 of some metric for example.

INSTALL GRAFANA ON YOUR SERVER

We’ll install Grafana in the same machine as the Zabbix Server to make the integration faster between both systems. So open an ssh connection with you zabbix server and follow these steps, the installation is very easy.

sudo apt-get install -y adduser libfontconfig1

wget https://dl.grafana.com/oss/release/grafana_6.7.2_amd64.deb

sudo dpkg -i grafana_6.7.2_amd64.deb

Maybe you see a newer version on Grafana website (download section)

Now that is installed you must start the service:

systemctl start grafana-server

At this point we can access our Grafana server with our web browser, open it and write this address:

http://ip-of-your-zabbix-server:3000/

Because the default port of Grafana is 3000. The default user is “admin” and password “admin”. It will prompt you to change it, be careful to put difficult password and save it in a proper and secure way.

INSTALL ZABBIX PLUGIN INTO GRAFANA

We need now to return to our ssh session with zabbix-server (or grafana-server as it is the same machine). And execute this command:

sudo grafana-cli plugins install alexanderzobnin-zabbix-app

And then restart your grafana server with:

sudo systemctl restart grafana-server

Now come again to you browser and on Grafana frontend look for plugins section on the left panel:

grafana plugins menu.PNG

Select Zabbix plugin and “Enable” it with the button. Once the plugin is enabled we can add Datasources of the kind “zabbix” to our Grafana instance.

ADD ZABBIX DATASOURCE TO GRAFANA

Open the Datasources section in your left panel menu:

grafana datasources.PNG

And now click on the green button “Add datasource”, you will see a list of datasource types, just scroll down until you see Zabbix type. You will see a detailed datasource page like this one:

You must write in the URL, exactly this:

http://127.0.0.1/zabbix/api_jsonrpc.php

And in the Zabbix API details your username and password of the Zabbix frontend (you must have well noted your password). And don’t change anything more, don’t switch anything. Just click below in the “Test & Save” green button.

CREATE A NEW DASHBOARD

Now we can go to our left panel and select Create a clean Dashboard option:

grafana new dashboard.PNG

Here you can play with your data from zabbix. We’ll make an example.

TOP RIGHT MENU

This menu help us to add panels, a panel is a graph or a list of items. Here we can see what timeline we are looking at, is very easy to change our perspective to shorter or longer time view.

Grafana up-right menu.PNG

With the button in the far right corner you can make the dashboard to auto-refresh for example every 5 minutes. And remember always to save your changes in the dashboard with the “Save” icon just next to “Add panel” one.

YOUR FIRST PANEL

Grafana Add query.PNG

Click on “Add Query” to search for your datasource. By default it will charge zabbix as it is your only datasource at the moment.

You can select a Group of host if you have it defined in your Zabbix Server, for example Battle of Nodes hosts. In host field you can select one host or all of them with /.*/

grafana select host.PNG

Now select the Application, remember in our case we will use “Elrond Node” in this example. You will see a list of items, all of them like in this example:

Grafana Application Elrond Node.PNG

We can select all of them with this expression in the field Item:

/ERD Connected Peers to.*/

With this we say that we want all the items that start with “ERD Connected Peers to” and whatever after it. This way we’ll have all the items for our nodes, because the name of the item in zabbix is customized with every node name.

Now we can use the “Functions” for example to filter the 5 bottom values as in this example:

Grafana filter botton.PNG

In this panel edition page, you have a left panel with: Queries, Visualization, General and Alerts sections.

Go to General to change the panel name and save it with the proper icon top-right.

Grafana first panel v3.PNG

Now you have in your Dashboard your first panel. You can adjust the height or width of the panel making click in the low-right corner and moving it. Remember to save the dashboard too with the top-right save button.

Now you can play around to make the Dashboard fit well your needs.

The Palm Tree Network has setup an easy first dashboard for Elrond Nodes. In the next chapter of the guide you will learn how to import it to your Grafana instance.