08-27-2010 04:39 AM
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,
Solved! Go to Solution.
08-28-2010 05:50 PM
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.
08-28-2010 05:50 PM
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.
09-16-2010 07:24 AM
Thanks Joseph Clarke.
It is the good way to get the interface uptime/downtime.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide