Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange question - is it possible to see when switchport was last used 1

Status
Not open for further replies.

zamkh

MIS
Sep 24, 2008
8
GB
Hi,

Another day, another question!

Our 5510 stacks are quite full - nearly every port is plugged in, but not all of them are 'used' due to desk moves, etc. Without unplugging all 'dead' ports only to find that it is indeed used albeit occassionally (e.g. meeting room) .. is there is a way to log/see when a port last came 'up'? Is the "LastChange" field the value I should be looking at?

Ta!
Manish
 
So it looks like LastChange does tell you when last there was an activity on the port like linkup/linkdown. So if you work out how long your switch stack has been running (eg 180 days) you should be able to create a query as to which ports whose lastchange field is > 40 days if you could output that value to a file.

The question is how!!!
 
You want to query the ifInOctets for each port. If the value doesn't change after X days then you have an idle port.

Cheers!
 
If your going to use SNMP the easiest way is probably to download and install Net-SNMP from net-snmp.org

To look at the last status of port X you'd use:
snmpget -v 1 -c community switch .1.3.6.1.2.1.2.2.1.9.X

To look at all the ports you'd use:
snmpwalk -v 1 -c community switch .1.3.6.1.2.1.2.2.1.9

There are other options to format the output and use different versions of SNMP, ect, ect.

As I recall ifLastChange is the offset from sysUpTime so its actually telling you that the port changed status a given number of milliseconds after the switch booted. This means that a ifLastChange of 0 (or some really small value) means the port has never been used. sysUpTime is at OID .1.3.6.1.2.1.1.3.0 and as you mention you could compare the two.

I've written a Perl script that compares the two and changes them both into actual dates and times, if anyone is interested I can find it... but for a one-time check using net-snmp like mentioned above is probably quicker than waiting for me to dig around in the code for my management systems.
 
Thakns for the valuable information! I will definitely give that a shot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top