How are network interface metrics calculated using SNMP?

How are network interface metrics calculated using SNMP?

Interface reports provide visibility into the performance and health of network interfaces. These reports use SNMP data collected at intervals to compute key metrics that help monitor traffic flow, detect anomalies, and optimize bandwidth usage. Below is an overview of how each metric is calculated:
Parameters used in calculations
Metric
SNMP OID
Description
Rx Volume (bytes)
.1.3.6.1.2.1.2.2.1.10
Difference between two ifInOctets values collected during subsequent polls.
Tx Volume (bytes)
.1.3.6.1.2.1.2.2.1.16
Difference between two ifOutOctets values collected during subsequent polls.
ifInOctets (bytes)
.1.3.6.1.2.1.2.2.1.10
Total number of octets received on the interface, including framing characters.
ifOutOctets (bytes)
.1.3.6.1.2.1.2.2.1.16
Total number of octets sent from the interface, including framing characters.
InSpeed/ifSpeed
.1.3.6.1.2.1.2.2.1.5
An estimate of the interface's current bandwidth in bits per second. (Can be defined by user).
OutSpeed/ifSpeed
.1.3.6.1.2.1.2.2.1.5
An estimate of the interface(s) current bandwidth in bits per second. (Can be defined by user).
InErrors
.1.3.6.1.2.1.2.2.1.14
Inbound packets with errors.
OutErrors
.1.3.6.1.2.1.2.2.1.20
Outbound packets with errors.
InDiscards
.1.3.6.1.2.1.2.2.1.13
Dropped inbound packets without errors.
OutDiscards
.1.3.6.1.2.1.2.2.1.19
Dropped outbound packets without errors.
InUcast
.1.3.6.1.2.1.2.2.1.11
Unicast packets received.
OutUcast
.1.3.6.1.2.1.2.2.1.17
Unicast packets transmitted.
InUnknownProtos
.1.3.6.1.2.1.2.2.1.15
Packets dropped due to unknown protocols.
HcInMcast
.1.3.6.1.2.1.31.1.1.1.8
High-capacity multicast packets received.
HcOutMcast
.1.3.6.1.2.1.31.1.1.1.12
High-capacity multicast packets sent.
HcInBcast
.1.3.6.1.2.1.31.1.1.1.9
High-capacity broadcast packets received.
HcOutBcast
.1.3.6.1.2.1.31.1.1.1.13
High-capacity broadcast packets sent.

Interface traffic

Calculates the volume of data transmitted and received over time.
Formula:
In Traffic(bps): (Rx Volume × 8) / Time interval (sec)
Out Traffic(bps): (Tx Volume × 8) / Time interval (sec)
Let’s say SNMP polling is done every five minutes (300 seconds = 300,000 milliseconds):
  1. InOctets at 0th minute = 1,000
  2. InOctets at fifth minute = 2,000
Hence,
In Traffic = ((2000 - 1000) × 8) / 300 
           = (1000 × 8) / 300           
           = 26.67 bps
Total Traffic (bps) = [(Rx Volume + Tx Volume) × 8] / Time interval (seconds) 
(or) 
In Traffic(bps) + Out Traffic(bps)
Info
Multiplying by eight converts bytes to bits, since SNMP counters report in octets (1 octet = 1 byte).

Interface utilization

Interface utilization represents how much of the interface's total bandwidth is being consumed by traffic over a period of time.
Formula:
In Utilization(%): (InTraffic/InSpeed) x 100 (Rx Volume x 8 x 100/Time interval (sec) x InSpeed)
Out Utilization(%): (OutTraffic/OutSpeed) x 100 = (Tx Volume x 8 x 100/Time interval (sec)  x OutSpeed)

Packets

The Rx Packets metric shows the rate at which the network interface is receiving packets over a given polling period. It is derived from a combination of various inbound packet counters gathered via SNMP.
Formula:
Rx Packets = (InUcast + InDiscards + InErrors + InUnknownProtos + HcInMcast + HcInBcast) / Time interval (sec)
Tx Packets = (OutUcast + HcOutMcast + HcOutBcast) / Time interval (sec)
This calculation enables network administrators to monitor the rate of incoming traffic and quickly detect any anomalies—such as spikes in errors or discards—that might indicate issues with the interface or network congestion.

Error rate(%)

The error rate reflects the percentage of packets that encountered issues during transmission or reception, relative to the total number of packets processed by the interface.
Formula:
Using 32-bit counters
These are standard SNMP counters used on most interfaces.
Error Rate = ((InErrors + OutErrors) × 100)/(InUcast + OutUcast + InDiscards + OutDiscards + InErrors + OutErrors + InUnknownProtos + HcInBcast + HcOutBcast)
Using 64-bit counters
Used for high-speed interfaces and accurate long-term monitoring.
Error Rate = ((InErrors + OutErrors) × 100)/(InUcast + OutUcast + InDiscards + OutDiscards + InErrors + OutErrors + InUnknownProtos + HcInMcast + HcOutMcast + HcInBcast + HcOutBcast)

Volume

Represents the total bytes transmitted and received over an interface during the polling interval.
Formulas:
  1. Rx Volume = Difference between two ifInOctets values collected during subsequent polls.
  2. Tx Volume = Difference between two ifOutOctets values collected during subsequent polls.
  3. Total Volume = Rx Volume + Tx Volume

Errors and Discards

Tracks the number of packets that were either erroneous or discarded on ingress or egress.
Formulas:
  1. Rx Error = InErrors
  2. Tx Error = OutErrors
  3. Total Errors = Rx Error + Tx Error
  4. Rx Discard = InDiscards
  5. Tx Discard = OutDiscards
  6. Total Discards = Rx Discard + Tx Discard