Calculating interface bandwidth percentage usage, from Zabbix datasource

Hi everyone,

I have CISCO switches monitored using Zabbix, and I want to calculate the bandwidth percentage usage per interface.

What is already done:

  • Query A: get bits sent per interface (item = /.*Bits sent.*/)
  • Query B: get speed per interface (item = /.*Speed.*/)

Ouput data (with one interface example, but can be multiple, and can be “correlate” using prefix “HostnameN: InterfaceN” if needed):

Time HostnameN: InterfaceN: Bits sent HostnameN: InterfaceN: Speed
08/11/2024 07:45 36055968
08/11/2024 07:48 34947416
08/11/2024 07:51 36797744
08/11/2024 07:54 32144136
08/11/2024 07:57 34039800
08/11/2024 08:00 43715248 1000000000
08/11/2024 08:03 34335800
08/11/2024 08:06 37372872

I am able to display all the values separately on a graph, but I am struggling to display the calculation for each interface as (“bits sent interface X” / “speed interface X”) * 100…

I have tried using

  • “Expression” query (Math with $A / $B) : no output, because no data in speed sometimes ?
  • “Add field from calculation” transformation: works well but i need to specify item name divided by another specific item name.

I hope this explanation is clear, thanks in advance for your help and time!

Hello and welcome to the foruns,

The best way for you would be calculating the percentage in zabbix side using Caculated Items, and then, juat showing it on Grafana’s side.

That way, grafana don’t need to calculate or understand the complexity of the collection at the datasource.

Hope it helps.

Yes, that’s what I was thinking of doing in the end, but I would have preferred a solution in Grafana, firstly to test the tool and its various features myself, and secondly to avoid putting metrics in Zabbix that were only there for grafana.
Thanks @isaqueprofeta !

1 Like