This article explains the reason that the counters retrieved from MIB OID is different from the value reported in 'show interfaces extensive' or 'show interfaces queue'.
On EX series devices, the SNMP MIB OID 'jnxCosIfqTailDropPkts' or 'jnxCosQstatTailDropPkts' is used to get the tail drop value from interfaces. The 'show interfaces extensive' and 'show interfaces queue' commands also report the tail drop value.
Below is an example showing the commands to retrieve the tail drop counters via SNMP and via the 'show interfaces' command. The values are expected to be the same.
{master:0} root> show snmp mib walk jnxCosQstatTailDropPkts.546 jnxCosQstatTailDropPkts.546.0 = 712949 jnxCosQstatTailDropPkts.546.1 = 0 jnxCosQstatTailDropPkts.546.2 = 0 jnxCosQstatTailDropPkts.546.3 = 0 jnxCosQstatTailDropPkts.546.4 = 0 jnxCosQstatTailDropPkts.546.5 = 0 jnxCosQstatTailDropPkts.546.6 = 0 jnxCosQstatTailDropPkts.546.7 = 0 {master:0} root> show interfaces queue ge-0/0/21 | no-more Physical interface: ge-0/0/21, Enabled, Physical link is Up Interface index: 132, SNMP ifIndex: 546 Forwarding classes: 16 supported, 4 in use Egress queues: 8 supported, 4 in use Queue: 0, Forwarding classes: best-effort Queued: Transmitted: Packets : 8774793 Bytes : 561586776 Tail-dropped packets : 712949 Queue: 1, Forwarding classes: assured-forwarding Queued: Transmitted: Packets : 0 Bytes : 0 Tail-dropped packets : 0 Queue: 5, Forwarding classes: expedited-forwarding Queued: Transmitted: Packets : 0 Bytes : 0 Tail-dropped packets : 0 Queue: 7, Forwarding classes: network-control Queued: Transmitted: Packets : 399 Bytes : 33734 Tail-dropped packets : 0 root>
The mismatch is caused when the "clear interfaces statistics" command is run.
For example:
root> clear interfaces statistics ge-0/0/21 {master:0} root> show snmp mib walk jnxCosQstatTailDropPkts.546 jnxCosQstatTailDropPkts.546.0 = 712949 jnxCosQstatTailDropPkts.546.1 = 0 jnxCosQstatTailDropPkts.546.2 = 0 jnxCosQstatTailDropPkts.546.3 = 0 jnxCosQstatTailDropPkts.546.4 = 0 jnxCosQstatTailDropPkts.546.5 = 0 jnxCosQstatTailDropPkts.546.6 = 0 jnxCosQstatTailDropPkts.546.7 = 0 {master:0} root> {master:0} root> show interfaces queue ge-0/0/21 | no-more Physical interface: ge-0/0/21, Enabled, Physical link is Up Interface index: 132, SNMP ifIndex: 546 Forwarding classes: 16 supported, 4 in use Egress queues: 8 supported, 4 in use Queue: 0, Forwarding classes: best-effort Queued: Transmitted: Packets : 0 Bytes : 0 Tail-dropped packets : 0 Queue: 1, Forwarding classes: assured-forwarding Queued: Transmitted: Packets : 0 Bytes : 0 Tail-dropped packets : 0 Queue: 5, Forwarding classes: expedited-forwarding Queued: Transmitted: Packets : 0 Bytes : 0 Tail-dropped packets : 0 Queue: 7, Forwarding classes: network-control Queued: Transmitted: Packets : 2 Bytes : 136 Tail-dropped packets : 0
{master:0} root> show snmp mib walk jnxCosQstatTailDropPkts.546 jnxCosQstatTailDropPkts.546.0 = 3840995 jnxCosQstatTailDropPkts.546.1 = 0 jnxCosQstatTailDropPkts.546.2 = 0 jnxCosQstatTailDropPkts.546.3 = 0 jnxCosQstatTailDropPkts.546.4 = 0 jnxCosQstatTailDropPkts.546.5 = 0 jnxCosQstatTailDropPkts.546.6 = 0 jnxCosQstatTailDropPkts.546.7 = 0 {master:0} root> show interfaces queue ge-0/0/21 | no-more Physical interface: ge-0/0/21, Enabled, Physical link is Up Interface index: 132, SNMP ifIndex: 546 Forwarding classes: 16 supported, 4 in use Egress queues: 8 supported, 4 in use Queue: 0, Forwarding classes: best-effort Queued: Transmitted: Packets : 21635339 Bytes : 1384661696 Tail-dropped packets : 3128046 Queue: 1, Forwarding classes: assured-forwarding Queued: Transmitted: Packets : 0 Bytes : 0 Tail-dropped packets : 0 Queue: 5, Forwarding classes: expedited-forwarding Queued: Transmitted: Packets : 0 Bytes : 0 Tail-dropped packets : 0 Queue: 7, Forwarding classes: network-control Queued: Transmitted: Packets : 89 Bytes : 7537 Tail-dropped packets : 0 root>
This is expected behavior if the 'clear interfaces statistics' command has been executed sometime before through the CLI (Command Line Interface) on the switch. See PR747155 . Juniper MIB counters are real-time. The number of packets shown in the counter statistics of Snmpwalk ('jnxCosIfqTailDropPkts' or 'jnxCosQstatTailDropPkts') is the number of packets (dropped) since system start up. These stats are stored in the kernel and the values are NOT refreshed or reset after a particular time interval. It persists even when there is an interface flap or when interface statistics are cleared or when snmp/mib2d restarts. In case of a SNMP or mib2d restart, snmpd reads the counters from the kernel again. The only way to reset the statistics is by rebooting the device. This behavior is as same for all SNMP MIB OIDs under the 'jnxCosIfqStatsTable' tree, i.e the "Transmitted bytes" OID 'jnxCosIfqTxedBytes'.