How to Make a graph of consecutive values in Prometheus

In a Debian Os target, I want to calculate BandWidth utilization "%" on a 1-minute interval and generate a graph of these BW values over 1Hr time window using Prometheus.

"60 minutes = 60 different values of BW"

I configured snmp_exporter to scrape snmp_agent metrics such as ifHCInOctets from the target server and here's the equation:

Interface In Utilization % =

((( [Total Sent packets in Bytes "ifHCInOctets_time2" - Total Sent packets in Bytes "ifHCInOctets _time1"] * 8 "Bytes into Bits") / ▲time "60s") / Maximum-Bandwidth "in bits/sec") * 100 "%"

How can I apply this equation in ▲time=60s intervals and apply it for a 1H time-window and depict these 60 values of BW consecutively in a Prometheus graph enter image description here

1 answer

  • answered 2022-04-21 08:10 rkosegi

    PromQL expression should looks like this:

    (rate(ifHCOutOctets[1m]) * 8) / (ifHighSpeed * 1000000) * 100

    If you want to restrict to particular interface, add filter like

    (rate(ifHCOutOctets{ifIndex="0"}[1m]) * 8) / (ifHighSpeed{ifIndex="0"} * 1000000) * 100

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum