Good afternoon to all forum members.
Will some one kindly enlighten me?
Which SNMP MIB \ OID should I be querying to determine how long (Time) an interface on a switch has been up or down?
Does any one actually know the answer to this question or will it remain a black hole?
HG
			
			
									
						
										
						Interface UP\Down Time
- 
				one6f
 
Re: Interface UP\Down Time
Hi
do you mean Last Change from 'interfaces.ifTable.ifEntry.ifLastChange':
.1.3.6.1.2.1.2.2.1.9
ex:
snmpwalk -Os -c public -v 1 172.x.x.x .1.3.6.1.2.1.2.2.1.9.1048
ifLastChange.1048 = Timeticks: (4935) 0:00:49.35
			
			
									
						
										
						do you mean Last Change from 'interfaces.ifTable.ifEntry.ifLastChange':
.1.3.6.1.2.1.2.2.1.9
ex:
snmpwalk -Os -c public -v 1 172.x.x.x .1.3.6.1.2.1.2.2.1.9.1048
ifLastChange.1048 = Timeticks: (4935) 0:00:49.35
- 
				hinesh
 
Re: Interface UP\Down Time
Hi one6f thanks for your post. Can you or another forum member advise me further?
I really need some help with this as I am unable to see the logic.
SNMPv2-MIB::sysUpTime.0 = Timeticks: (162950100) 18 days, 20:38:21.00 (this is the amount of time the physical switch has been up. As in running and operational)
YET!!!!!
IF-MIB::ifLastChange.1007 = Timeticks: (1305017578) 151 days, 1:02:55.78 (this is the amount of time port 7 (on the same switch) has been up for.
So the question begs, how on earth could port 7 have been up for 151 days.
When the switch its self has only been up for 18 days?
Is there some additional calculation required here or is this a genuine bug?
			
			
									
						
										
						I really need some help with this as I am unable to see the logic.
SNMPv2-MIB::sysUpTime.0 = Timeticks: (162950100) 18 days, 20:38:21.00 (this is the amount of time the physical switch has been up. As in running and operational)
YET!!!!!
IF-MIB::ifLastChange.1007 = Timeticks: (1305017578) 151 days, 1:02:55.78 (this is the amount of time port 7 (on the same switch) has been up for.
So the question begs, how on earth could port 7 have been up for 151 days.
When the switch its self has only been up for 18 days?
Is there some additional calculation required here or is this a genuine bug?
- 
				hinesh
 
Re: Interface UP\Down Time
Sorry and furthermore it’s not just 1 port, this rather strange value appears on numerous ports. Observe the data below taken from the same switch.
IF-MIB::ifLastChange.1001 = Timeticks: (1305208404) 151 days, 1:34:44.04
IF-MIB::ifLastChange.1002 = Timeticks: (1305214905) 151 days, 1:35:49.05
IF-MIB::ifLastChange.1003 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1004 = Timeticks: (1303795995) 150 days, 21:39:19.95
IF-MIB::ifLastChange.1005 = Timeticks: (1304940132) 151 days, 0:50:01.32
IF-MIB::ifLastChange.1006 = Timeticks: (1304519052) 150 days, 23:39:50.52
IF-MIB::ifLastChange.1007 = Timeticks: (1305017578) 151 days, 1:02:55.78
IF-MIB::ifLastChange.1008 = Timeticks: (1303585053) 150 days, 21:04:10.53
IF-MIB::ifLastChange.1009 = Timeticks: (1305176800) 151 days, 1:29:28.00
IF-MIB::ifLastChange.1010 = Timeticks: (1304358111) 150 days, 23:13:01.11
IF-MIB::ifLastChange.1011 = Timeticks: (1304422512) 150 days, 23:23:45.12
IF-MIB::ifLastChange.1012 = Timeticks: (1304464106) 150 days, 23:30:41.06
IF-MIB::ifLastChange.1013 = Timeticks: (1303795979) 150 days, 21:39:19.79
IF-MIB::ifLastChange.1014 = Timeticks: (1305208397) 151 days, 1:34:43.97
IF-MIB::ifLastChange.1015 = Timeticks: (1305209727) 151 days, 1:34:57.27
IF-MIB::ifLastChange.1016 = Timeticks: (1305183475) 151 days, 1:30:34.75
IF-MIB::ifLastChange.1017 = Timeticks: (1305210043) 151 days, 1:35:00.43
IF-MIB::ifLastChange.1018 = Timeticks: (1305036408) 151 days, 1:06:04.08
IF-MIB::ifLastChange.1019 = Timeticks: (1303887752) 150 days, 21:54:37.52
IF-MIB::ifLastChange.1020 = Timeticks: (1303877944) 150 days, 21:52:59.44
IF-MIB::ifLastChange.1021 = Timeticks: (1303797332) 150 days, 21:39:33.32
IF-MIB::ifLastChange.1022 = Timeticks: (1303585053) 150 days, 21:04:10.53
IF-MIB::ifLastChange.1023 = Timeticks: (1305209774) 151 days, 1:34:57.74
IF-MIB::ifLastChange.1024 = Timeticks: (1304438111) 150 days, 23:26:21.11
IF-MIB::ifLastChange.1025 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1026 = Timeticks: (1305208985) 151 days, 1:34:49.85
IF-MIB::ifLastChange.1027 = Timeticks: (1305033391) 151 days, 1:05:33.91
IF-MIB::ifLastChange.1028 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1029 = Timeticks: (1305204720) 151 days, 1:34:07.20
IF-MIB::ifLastChange.1030 = Timeticks: (1303791311) 150 days, 21:38:33.11
IF-MIB::ifLastChange.1031 = Timeticks: (1304953790) 151 days, 0:52:17.90
IF-MIB::ifLastChange.1032 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1033 = Timeticks: (1303795997) 150 days, 21:39:19.97
IF-MIB::ifLastChange.1034 = Timeticks: (1305017816) 151 days, 1:02:58.16
IF-MIB::ifLastChange.1035 = Timeticks: (1305115083) 151 days, 1:19:10.83
IF-MIB::ifLastChange.1036 = Timeticks: (1304852979) 151 days, 0:35:29.79
IF-MIB::ifLastChange.1037 = Timeticks: (1304923015) 151 days, 0:47:10.15
IF-MIB::ifLastChange.1038 = Timeticks: (1305025123) 151 days, 1:04:11.23
IF-MIB::ifLastChange.1039 = Timeticks: (1304583198) 150 days, 23:50:31.98
IF-MIB::ifLastChange.1040 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1041 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1042 = Timeticks: (1304610238) 150 days, 23:55:02.38
IF-MIB::ifLastChange.1043 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1044 = Timeticks: (1304918086) 151 days, 0:46:20.86
IF-MIB::ifLastChange.1045 = Timeticks: (1304685071) 151 days, 0:07:30.71
IF-MIB::ifLastChange.1046 = Timeticks: (1303989940) 150 days, 22:11:39.40
IF-MIB::ifLastChange.1047 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1048 = Timeticks: (1305102702) 151 days, 1:17:07.02
IF-MIB::ifLastChange.1049 = Timeticks: (1303585053) 150 days, 21:04:10.53
IF-MIB::ifLastChange.1050 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2001 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2002 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2003 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2004 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2005 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2006 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2007 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2008 = Timeticks: (1305113148) 151 days, 1:18:51.48
IF-MIB::ifLastChange.2009 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2010 = Timeticks: (1303744984) 150 days, 21:30:49.84
IF-MIB::ifLastChange.2011 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2012 = Timeticks: (1304954747) 151 days, 0:52:27.47
IF-MIB::ifLastChange.2013 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2014 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2015 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2016 = Timeticks: (1305013790) 151 days, 1:02:17.90
IF-MIB::ifLastChange.2017 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2018 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2019 = Timeticks: (1303993461) 150 days, 22:12:14.61
IF-MIB::ifLastChange.2020 = Timeticks: (1303973896) 150 days, 22:08:58.96
IF-MIB::ifLastChange.2021 = Timeticks: (1305203864) 151 days, 1:33:58.64
IF-MIB::ifLastChange.2022 = Timeticks: (1303585052) 150 days, 21:04:10.52
IF-MIB::ifLastChange.2023 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2024 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2025 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2026 = Timeticks: (1305180788) 151 days, 1:30:07.88
			
			
									
						
										
						IF-MIB::ifLastChange.1001 = Timeticks: (1305208404) 151 days, 1:34:44.04
IF-MIB::ifLastChange.1002 = Timeticks: (1305214905) 151 days, 1:35:49.05
IF-MIB::ifLastChange.1003 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1004 = Timeticks: (1303795995) 150 days, 21:39:19.95
IF-MIB::ifLastChange.1005 = Timeticks: (1304940132) 151 days, 0:50:01.32
IF-MIB::ifLastChange.1006 = Timeticks: (1304519052) 150 days, 23:39:50.52
IF-MIB::ifLastChange.1007 = Timeticks: (1305017578) 151 days, 1:02:55.78
IF-MIB::ifLastChange.1008 = Timeticks: (1303585053) 150 days, 21:04:10.53
IF-MIB::ifLastChange.1009 = Timeticks: (1305176800) 151 days, 1:29:28.00
IF-MIB::ifLastChange.1010 = Timeticks: (1304358111) 150 days, 23:13:01.11
IF-MIB::ifLastChange.1011 = Timeticks: (1304422512) 150 days, 23:23:45.12
IF-MIB::ifLastChange.1012 = Timeticks: (1304464106) 150 days, 23:30:41.06
IF-MIB::ifLastChange.1013 = Timeticks: (1303795979) 150 days, 21:39:19.79
IF-MIB::ifLastChange.1014 = Timeticks: (1305208397) 151 days, 1:34:43.97
IF-MIB::ifLastChange.1015 = Timeticks: (1305209727) 151 days, 1:34:57.27
IF-MIB::ifLastChange.1016 = Timeticks: (1305183475) 151 days, 1:30:34.75
IF-MIB::ifLastChange.1017 = Timeticks: (1305210043) 151 days, 1:35:00.43
IF-MIB::ifLastChange.1018 = Timeticks: (1305036408) 151 days, 1:06:04.08
IF-MIB::ifLastChange.1019 = Timeticks: (1303887752) 150 days, 21:54:37.52
IF-MIB::ifLastChange.1020 = Timeticks: (1303877944) 150 days, 21:52:59.44
IF-MIB::ifLastChange.1021 = Timeticks: (1303797332) 150 days, 21:39:33.32
IF-MIB::ifLastChange.1022 = Timeticks: (1303585053) 150 days, 21:04:10.53
IF-MIB::ifLastChange.1023 = Timeticks: (1305209774) 151 days, 1:34:57.74
IF-MIB::ifLastChange.1024 = Timeticks: (1304438111) 150 days, 23:26:21.11
IF-MIB::ifLastChange.1025 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1026 = Timeticks: (1305208985) 151 days, 1:34:49.85
IF-MIB::ifLastChange.1027 = Timeticks: (1305033391) 151 days, 1:05:33.91
IF-MIB::ifLastChange.1028 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1029 = Timeticks: (1305204720) 151 days, 1:34:07.20
IF-MIB::ifLastChange.1030 = Timeticks: (1303791311) 150 days, 21:38:33.11
IF-MIB::ifLastChange.1031 = Timeticks: (1304953790) 151 days, 0:52:17.90
IF-MIB::ifLastChange.1032 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1033 = Timeticks: (1303795997) 150 days, 21:39:19.97
IF-MIB::ifLastChange.1034 = Timeticks: (1305017816) 151 days, 1:02:58.16
IF-MIB::ifLastChange.1035 = Timeticks: (1305115083) 151 days, 1:19:10.83
IF-MIB::ifLastChange.1036 = Timeticks: (1304852979) 151 days, 0:35:29.79
IF-MIB::ifLastChange.1037 = Timeticks: (1304923015) 151 days, 0:47:10.15
IF-MIB::ifLastChange.1038 = Timeticks: (1305025123) 151 days, 1:04:11.23
IF-MIB::ifLastChange.1039 = Timeticks: (1304583198) 150 days, 23:50:31.98
IF-MIB::ifLastChange.1040 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1041 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1042 = Timeticks: (1304610238) 150 days, 23:55:02.38
IF-MIB::ifLastChange.1043 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1044 = Timeticks: (1304918086) 151 days, 0:46:20.86
IF-MIB::ifLastChange.1045 = Timeticks: (1304685071) 151 days, 0:07:30.71
IF-MIB::ifLastChange.1046 = Timeticks: (1303989940) 150 days, 22:11:39.40
IF-MIB::ifLastChange.1047 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.1048 = Timeticks: (1305102702) 151 days, 1:17:07.02
IF-MIB::ifLastChange.1049 = Timeticks: (1303585053) 150 days, 21:04:10.53
IF-MIB::ifLastChange.1050 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2001 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2002 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2003 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2004 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2005 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2006 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2007 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2008 = Timeticks: (1305113148) 151 days, 1:18:51.48
IF-MIB::ifLastChange.2009 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2010 = Timeticks: (1303744984) 150 days, 21:30:49.84
IF-MIB::ifLastChange.2011 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2012 = Timeticks: (1304954747) 151 days, 0:52:27.47
IF-MIB::ifLastChange.2013 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2014 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2015 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2016 = Timeticks: (1305013790) 151 days, 1:02:17.90
IF-MIB::ifLastChange.2017 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2018 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2019 = Timeticks: (1303993461) 150 days, 22:12:14.61
IF-MIB::ifLastChange.2020 = Timeticks: (1303973896) 150 days, 22:08:58.96
IF-MIB::ifLastChange.2021 = Timeticks: (1305203864) 151 days, 1:33:58.64
IF-MIB::ifLastChange.2022 = Timeticks: (1303585052) 150 days, 21:04:10.52
IF-MIB::ifLastChange.2023 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2024 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2025 = Timeticks: (0) 0:00:00.00
IF-MIB::ifLastChange.2026 = Timeticks: (1305180788) 151 days, 1:30:07.88
- 
				hinesh
 
Re: Interface UP\Down Time
IN ESSENCE THIS IS EXACTLY WHAT I WANT TO KNOW?
USING SNMP QUERIES
FROM THE POINT A SWITCH IS POWERED UP (AND IS OPERATIONAL AND NETWORKED)
HOW LONG HAS A PORT OR A NUMBER OF PORTS ON THIS SWITCH BEEN UP FOR AS IN TIME?
			
			
									
						
										
						USING SNMP QUERIES
FROM THE POINT A SWITCH IS POWERED UP (AND IS OPERATIONAL AND NETWORKED)
HOW LONG HAS A PORT OR A NUMBER OF PORTS ON THIS SWITCH BEEN UP FOR AS IN TIME?
- 
				one6f
 
Re: Interface UP\Down Time
Hi hinesh,
ifOperStatus must be Up. It is important to note that the value returned is the uptime value of the system since the interface last changed states. Therefore, if for example IF-MIB::ifLastChange.3006 = 8640000 (which would be 1 day; value is in 100th of seconds) then you would have to subtract this value from the value returned by querying 1.3.6.1.2.1.1.3.0 (sysUptime) and then divide that result by 100 to figure out the number of seconds which have passed since the last interface state change.
In practice:
hugo$ date +%s
1305725730
hugo$ snmpwalk -On -v3 -u bla bla 10.1.1.23 .1.3.6.1.2.1.1.3.0
.1.3.6.1.2.1.1.3.0 = Timeticks: (2668025700) 308 days, 19:10:57.00
hugo$ snmpwalk -On -v3 -u bla bla 10.1.1.23 .1.3.6.1.2.1.2.2.1.9.3006
.1.3.6.1.2.1.2.2.1.9.3006 = Timeticks: (2382528300) 275 days, 18:08:03.00
hugo$ date -d @`echo '1305725730-(2668025700-2382528300)/100'|bc`
Fri Apr 15 14:32:36 CEST 2011
Compare with console output:
sw23> show interfaces 3/6
Slot/Port 3/6 :
Operational Status : up,
Last Time Link Changed : FRI APR 15 14:32:36 ,
.....
			
			
									
						
										
						ifOperStatus must be Up. It is important to note that the value returned is the uptime value of the system since the interface last changed states. Therefore, if for example IF-MIB::ifLastChange.3006 = 8640000 (which would be 1 day; value is in 100th of seconds) then you would have to subtract this value from the value returned by querying 1.3.6.1.2.1.1.3.0 (sysUptime) and then divide that result by 100 to figure out the number of seconds which have passed since the last interface state change.
In practice:
hugo$ date +%s
1305725730
hugo$ snmpwalk -On -v3 -u bla bla 10.1.1.23 .1.3.6.1.2.1.1.3.0
.1.3.6.1.2.1.1.3.0 = Timeticks: (2668025700) 308 days, 19:10:57.00
hugo$ snmpwalk -On -v3 -u bla bla 10.1.1.23 .1.3.6.1.2.1.2.2.1.9.3006
.1.3.6.1.2.1.2.2.1.9.3006 = Timeticks: (2382528300) 275 days, 18:08:03.00
hugo$ date -d @`echo '1305725730-(2668025700-2382528300)/100'|bc`
Fri Apr 15 14:32:36 CEST 2011
Compare with console output:
sw23> show interfaces 3/6
Slot/Port 3/6 :
Operational Status : up,
Last Time Link Changed : FRI APR 15 14:32:36 ,
.....
- 
				hinesh
 
Re: Interface UP\Down Time
Hi one6f thank you so much for your feedback, and I understand most of the calculation, however I am some what confused as to where you got this figure from?
1305725730
Can you please kindly explain to me, what this figure is and how you came to it?
Kind regards
			
			
									
						
										
						1305725730
Can you please kindly explain to me, what this figure is and how you came to it?
Kind regards
- 
				one6f
 
Re: Interface UP\Down Time
HI ,
it's simply linux time now (under linux command date -- display or set date and time).
Unix/Linux timestamp are the number of seconds since midnight, January 1, 1970 GMT
			
			
									
						
										
						it's simply linux time now (under linux command date -- display or set date and time).
Unix/Linux timestamp are the number of seconds since midnight, January 1, 1970 GMT
