Cisco SNMP – Exporting IF-MIB Stats Interval in Cisco IOS

ciscomanagementroutersnmp

I'm developing a SNMP Monitor for my company. I've done it before, and that is why I'm not sure why I have the behavior, and because I'm not a network engineer, I'm not a 100% sure where to go and trouble shoot the problem.

I'm requesting OID 1.3.6.1.2.1.2.2.1.10 (In Octets for an interface) and I receive a value. However, If I request it again 5 seconds later, I get exactly the same value, but 5 seconds later there is movement. If I request it every 10 seconds, there is movement all the time. (I do request the Out Octets as well, and experience the same behavior)

If I log on to the router and I run sh int fastEthernet 0/0/0 the input bytes changes the whole time like I expect.

At my previous company I did a similar monitor, and I requested the value every 2 seconds, and it worked fine. Unfortunately I cannot remember the series of the Cisco routers there.

Running Wireshark I see the requests and responses, and the response from the router definitely returns the same value.

I have 3 questions regarding this.

  • Is there a setting or configuration that I can set?
  • Will it be better to use traps instead of query?
  • Is this native to the 1900 series to only update the SNMP agent (forgive me if this is the wrong terminology) like it is doing at the moment.

Any help in any direction will be appreciated. If there is any information that you need that I might have left out, please ask. Like I said, I'm not a network engineer.

Thanks in advance

Best Answer

  • Is this native to the 1900 series to only update the SNMP agent (forgive me if this is the wrong terminology) like it is doing at the moment.

What you're seeing is expected behavior. IOS has cached IF-MIB statistics for on 10-second intervals (by default) for a while, for instance see this entry in the SNMP FAQ.

That said, I have a few switches which seem to defy this "typical" 10-second SNMP stats export interval.

  • Is there a setting or configuration that I can set?

Use service counters max age [age-in-seconds]; this command will show up in the running configuration; however, it's not available in older versions of IOS.

You can also change the IF-MIB 64-bit counters to update interval with this hidden command: snmp-server hc poll [interval], where the interval is measured in hundredths of seconds; however, this command will not show up in the running configuration.

  • Will it be better to use traps instead of query?

It won't matter whether you push or pull, unless your platform exports the stats quickly enough.