SNMP statistics for interfaces not clearing after they are cleared

Interface statistics are not clearing via SNMP even though they are showing zeros under the show interface extensive.

For all JUNOS platform, the interfaces statistics are not clearing via snmp after they are clear from the cli. Please take a look to the following outputs,
Topology: Mx480(ge-5/2/0.0).1 ————–.2 (ge3/0/1.0)m120 – Addressing: 10.10.10/30
OID: ifInOctets
From MX480:
when we check the show interface statistics, we do see that the interface has some traffic outputs,

When we perform a query using the SNMP OID, we received a different value,

We can try to clear the stastics from the interface using clear interface command,

But they are not clear as we can see via SNMP,

We can try to restart the SNMP/Mib-process and we will still have the same behavior,

This is an expected behavior for all the JUNOS platforms. What happens is that SNMPD will look at the kernel for the statistics and in there they actual values are accumulated so every time that the query is done for any statistics you will have the value accumulated in order to have the actual values or statistics since the interface was brought up. Another thing to keep in consideration is that all the JUNOS counters are real time. These stats are stored in kernel. This number is NOT refreshed or reset after a particular time interval.

As it is represented above even though the process are killed you will see that the counters are incrementing. We have also check that by an interface flapped, it will show the same values.

The only way to have this counter reset, it is to reboot the JUNOS device or offline/online the line card. Please look an example for the line card rebot.

Here, we offline the FPC,

We verify that it is offline,

Then we online the card,

When we run the query for the same OID,

We receive the actual value that the interface has,

The second will be just to reboot the entire device and it will behave in the same manner.

About the author

James Palmer

Leave a Comment