Question about show version uptime vs. snmp OID

Answered Question
Dec 10th, 2009

I've noticed that the timetick value for system uptime (OID is a 32-bit value so once the system has been up for 1 year, 132 days, 2 hours, 27 minutes and 52.96 seconds the value will roll to 0 again.  This is a problem because if I want to calculate the time an interface has been in its current state (which is stored in another OID as the current sysUptime when the interface entered its current ifOperStatus) then the number becomes negative when the sysUpTime value rolls to 0.  For example, suppose a switch port ifOperStatus goes to 'up' 45 seconds after the switch initializes.  The ifLastChange value would be somewhere around 4500.  45 seconds later, the timetick value in (sysUptime) would be 9000 and if I subtracted 4500 from 9000 I'd get 4500 which would represent the fact that the port has been 'up' for 45 seconds.  If the switch remains up for a really long time (longer than 1 year, 132 days....) and that sysUptime value rolls to zero then 0 - 4500 becomes -4500 when I try to calculate sysUptime - ifLastChange.   HOWEVER, I've noticed that the "show version" command will report the accurate system uptime regardless of the number of seconds the switch has been up.  So my question is this:  is there another OID I can look at that will tell me how many times the sysUptime value has rolled back to 0?  The switch must be aware of it somehow because the uptime reported by 'show version' does report the correct time. Or, is there a different OID that tracks system uptime that's greater than a 32-bit value?

I have this problem too.
0 votes
Correct Answer by yjdabear about 7 years 1 month ago

Yes, you have the snmpEngineTime / . option on IOS 12.0(3)T or later, as explained in this post:

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)


This Discussion