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: 1.3.6.1.2.1.2.2.1.10 ifInOctets
From MX480:
when we check the show interface statistics, we do see that the interface has some traffic outputs,
lab@lab> show interfaces ge-5/2/0.0 extensive Logical interface ge-5/2/0.0 (Index 65543) (SNMP ifIndex 611) (Generation 203) Flags: SNMP-Traps 0x4004000 Encapsulation: ENET2 Traffic statistics: Input bytes : 420 Output bytes : 490 Input packets: 5 Output packets: 5 Local statistics: Input bytes : 420 Output bytes : 490 Input packets: 5 Output packets: 5 Transit statistics: Input bytes : 0 0 bps Output bytes : 0 0 bps Input packets: 0 0 pps Output packets: 0 0 pps
When we perform a query using the SNMP OID, we received a different value,
lab@lab> show snmp mib walk 1.3.6.1.2.1.2.2.1.10 | match 611 ifInOctets.611 = 2316
We can try to clear the stastics from the interface using clear interface command,
lab@lab> clear interfaces statistics ge-5/2/0 lab@lab> show interfaces ge-5/2/0.0 extensive Logical interface ge-5/2/0.0 (Index 65543) (SNMP ifIndex 611) (Generation 203) Flags: SNMP-Traps 0x4004000 Encapsulation: ENET2 Traffic statistics: Input bytes : 0 Output bytes : 0 Input packets: 0 Output packets: 0 Local statistics: Input bytes : 0 Output bytes : 0 Input packets: 0 Output packets: 0 Transit statistics: Input bytes : 0 0 bps Output bytes : 0 0 bps Input packets: 0 0 pps Output packets: 0 0 pps
But they are not clear as we can see via SNMP,
lab@Contrabando> show snmp mib walk 1.3.6.1.2.1.2.2.1.10 | match 611 ifInOctets.611 = 2316
We can try to restart the SNMP/Mib-process and we will still have the same behavior,
lab@lab> restart snmp Simple Network Management Protocol process started, pid 73388 lab@lab> restart mib-process Management Information Base II process started, pid 73393 lab@lab> show snmp mib walk 1.3.6.1.2.1.2.2.1.10 | match 611 ifInOctets.611 = 2316
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,
lab@lab> request chassis fpc slot 5 offline Offline initiated, use "show chassis fpc" to verify
We verify that it is offline,
lab@lab> show chassis fpc Temp CPU Utilization (%) Memory Utilization (%) Slot State (C) Total Interrupt DRAM (MB) Heap Buffer 0 Online 30 7 0 2048 12 13 1 Online 29 10 0 2048 12 13 2 Online 34 7 0 2048 18 13 3 Empty 4 Online 38 6 0 1024 7 41 5 Offline ---Offlined by cli command---
Then we online the card,
lab@lab> request chassis fpc slot 5 online Online initiated, use "show chassis fpc" to verify lab@lab> show chassis fpc Temp CPU Utilization (%) Memory Utilization (%) Slot State (C) Total Interrupt DRAM (MB) Heap Buffer 0 Online 30 8 0 2048 12 13 1 Online 29 8 0 2048 12 13 2 Online 34 5 0 2048 18 13 3 Empty 4 Online 38 5 0 1024 7 41 5 Online 26 0 0 0 0 0 lab@lab> show chassis fpc Temp CPU Utilization (%) Memory Utilization (%) Slot State (C) Total Interrupt DRAM (MB) Heap Buffer 0 Online 30 8 0 2048 12 13 1 Online 29 8 0 2048 12 13 2 Online 34 5 0 2048 18 13 3 Empty 4 Online 38 5 0 1024 7 41 5 Online 26 0 0 0 0 0
When we run the query for the same OID,
lab@lab> show snmp mib walk 1.3.6.1.2.1.2.2.1.10 | match 611 ifInOctets.611 = 0
We receive the actual value that the interface has,
lab@lab> show interfaces ge-5/2/0.0 extensive Logical interface ge-5/2/0.0 (Index 141075) (SNMP ifIndex 611) (Generation 212) Flags: SNMP-Traps 0x4004000 Encapsulation: ENET2 Traffic statistics: Input bytes : 0 Output bytes : 0 Input packets: 0 Output packets: 0 Local statistics: Input bytes : 0 Output bytes : 0 Input packets: 0 Output packets: 0 Transit statistics: Input bytes : 0 0 bps Output bytes : 0 0 bps Input packets: 0 0 pps Output packets: 0 0 pps
The second will be just to reboot the entire device and it will behave in the same manner.