I have configured the bandwidth Utilization with the below formula, data i am getting after snmpwalk.
Utilization = ( ifinOctect * 8 * 100 ) /( ifspeed * delta_time )
now i want to know if what is the unit of output of this command.
I have configured the bandwidth Utilization with the below formula, data i am getting after snmpwalk.
Utilization = ( ifinOctect * 8 * 100 ) /( ifspeed * delta_time )
now i want to know if what is the unit of output of this command.
RFC2863 defines IF-MIB and has a clear explanation on what ifInOctets
and ifSpeed
(paragraph 3.1.7) is:
ifInOctets OBJECT-TYPE
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The total number of octets received on the interface,
including framing characters. [...]"
I would however not use ifInOctets
on modern devices. Since these are 32-bits counters you're running a high risk of a counter wrap (reaching max-int) before you've read it. When available (and any modern device should have it) ifHCInOctets
is of more use since it uses a 64-bit counter:
ifHCInOctets OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The total number of octets received on the interface,
including framing characters. This object is a 64-bit
version of ifInOctets.
Looking at your calculation:
Your calculation seems to be an attempt to determine the link utilisation as a percentage. However, the way you describe it does not work. ifInOctets
is an absolute number for the total of octets which were received. There's no notion of time there.
To determine link utilisation you would have to take two measurements (the increase in received packets). By dividing that by the time difference delta_time
you get the average number of packets/sec in the measured time interval. Multiply that by 8 to convert octets into bits. If you divide that result by the ifSpeed
(which is in bits/sec) you get a fraction representing the interface utilisation. Finally multiplying it by 100 would give you a percentage.
So if ifInOctet1
and ifInOctet2
are two consecutive measurements time_delta
apart in time, the calculation would be:
Utilization = ((ifInOctet2 - ifInOctet1) * 8 / delta_time) / ifSpeed * 100