Search code examples
grafanazabbix

Can't Change Metric Alias in Grafana Using a Zabbix Plugin


I want to show multiple CPU Usage from different hosts in one graph but they all end up with the same name and I can't tell which line represents which host: here's the snapshot.

I'm using Grafana 5.2.4 with a Zabbix plugin 3.9.1. My Zabbix version is 3.0.12. I've tried overriding legends in Grafana but there's no such option. Also, Zabbix plugin doesn't allow connecting directly to DB, so I can't use the ALIAS BY option either. I've tried using macros in Zabbix to include host name in item name, but {HOST.NAME} just ends up as is in the item name (and not replaced by the actual values).

Any solutions will be hugely appreciated.


Solution

  • You should use the templating feature of the Zabbix Grafana plugin,see the attached screens and the following description for a working example.

    I have a Routers Zabbix Hostgroup, so I define a Router Grafana variable to match the hosts (Routers.*), see the first screenshot. Enable both multi-value and Select All enter image description here

    Then in the metrics configuration use a single metric configured this way:

    • Group: Routers
    • Host: $Router (mind the $, the variable will be expanded in real time accordingly to the selection)
    • Item: the common item name (i.e.: ICMP Response Time)

    And you will get something similar to the second screenshot, with a host picker on top and multiple selections.

    enter image description here