sh int <name> link, which OID?

Answered Question
Aug 27th, 2010

Hello,


I'm trying to get downtime of several interfaces via SNMP.


I found this information with the command:


PACIFIC1-Q22752-1#sh int gigabitEthernet 1/1 link


Port    Name               Down Time        Down Since
Gi1/1                      36 weeks, 5 days, 51 minutes 28 secs      10:31:32  Sun Dec 13 2009


But I can't find the regarding OID.



Could you help me on this subject?


Thanks & Regards,

Correct Answer by Joe Clarke about 6 years 6 months ago

You want the timestamps you see here via SNMP?  You can do that by polling ifLastChange for a given interface.  This will give you the last time the interface changed state based on the sysUpTime of the device.  The value of sysUpTime is the number of seconds that the device has been up times 100 (i.e. it gives you hundredths of a second of uptime).  Take the current value of sysUpTime, and subtract that from the current date and time to get the time the device last booted.  Then, to that time, add the value of ifLastChange.  That will tell you the time the interface last changed state.  If the interface's ifOperStatus is currently "down" then you know the interface has been down since the time previously calculated.  If ifOperStatus is "up," then you know the interface has been up since the time previously calculated.


Here's an example from on of my devices:


RFC1213-MIB::sysUpTime = Timeticks: (96774850)


The router has been up for 11 days, four hours, 49 minutes, and eight seconds.


IF-MIB::ifLastChange.1 = Timeticks: (2629)
IF-MIB::ifOperStatus.1 = INTEGER: up(1)


My GigabitEthernet0/0 interface is currently up, and last changed state when sysUpTime was 2629 (~ 26 seconds after the device booted).  So, interface GigabitEthernet0/0 has been up since August 17, 2010 at around 15:50 localtime.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Joe Clarke Sat, 08/28/2010 - 17:50

You want the timestamps you see here via SNMP?  You can do that by polling ifLastChange for a given interface.  This will give you the last time the interface changed state based on the sysUpTime of the device.  The value of sysUpTime is the number of seconds that the device has been up times 100 (i.e. it gives you hundredths of a second of uptime).  Take the current value of sysUpTime, and subtract that from the current date and time to get the time the device last booted.  Then, to that time, add the value of ifLastChange.  That will tell you the time the interface last changed state.  If the interface's ifOperStatus is currently "down" then you know the interface has been down since the time previously calculated.  If ifOperStatus is "up," then you know the interface has been up since the time previously calculated.


Here's an example from on of my devices:


RFC1213-MIB::sysUpTime = Timeticks: (96774850)


The router has been up for 11 days, four hours, 49 minutes, and eight seconds.


IF-MIB::ifLastChange.1 = Timeticks: (2629)
IF-MIB::ifOperStatus.1 = INTEGER: up(1)


My GigabitEthernet0/0 interface is currently up, and last changed state when sysUpTime was 2629 (~ 26 seconds after the device booted).  So, interface GigabitEthernet0/0 has been up since August 17, 2010 at around 15:50 localtime.

Actions

This Discussion