0

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.

1
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
    – Ron Maupin
    Commented Dec 14, 2019 at 21:13

1 Answer 1

4

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

4
  • We are collecting the data every 5 minute, so delta_time is 300.
    – amit singh
    Commented Mar 6, 2019 at 7:08
  • I've updated my answer with some more details.
    – Teun Vink
    Commented Mar 6, 2019 at 8:08
  • i have a silly question when i ran these commands i gets IF-MIB::ifHCInOctets.1,IF-MIB::ifHCInOctets.2, what does these number 1,2 represent here.
    – amit singh
    Commented Mar 6, 2019 at 11:58
  • 1
    This is SNMP basics, it's a reference to the interface table in which all interfaces are listed.
    – Teun Vink
    Commented Mar 6, 2019 at 12:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.