poll-switch – SNMP poll a layer-2 device

Retrieving host and port information from a layer-2 switch running an SNMP agent.
Download Poll-switch source code via FTP: Latest Source release.
 
On this page:

NAME

poll-switch – SNMP poll a layer-2 device

SYNOPSIS

./poll-switch [-adhmPqV] [-n network] [-p port_name] [-v vlan] remote_agent SNMP_community_string [MAC_address1 MAC_address2 …]

DESCRIPTION

poll-switch retrieves host and port information from a layer-2 switch running an SNMP agent.

Notepoll-switch has only been tested on Cisco switches.

PSC Note; due to access restrictions poll-switch can only be run from sportpit,warden, & watchdog.

poll-switch uses SNMP to poll a remote agent (usually a layer-2 switch), and attempts to retrieve port and host information. poll-switch may be run in one of four ways; first, if no options are specified other than the required remote agent and SNMP community string arguments, all the MAC addresses learned on that switch and their associated ports are returned, sorted by VLAN. Secondly, if one or more MAC addresses follow the mandatory remote agent and community stringarguments, the port information for those specified MAC addresses will be returned, i.e., the port’s status, physical address, MTU, duplex setting and input & output counters. Next, if the -P option is used, poll-switch will list all the physical port interfaces configured on the switch, and if the -p port name option is used, poll-switch will return information for that port (this output is similar to that returned for specific MAC addresses, as well as all MAC addresses learned via that port). And finally, if the -V option is specified, then poll-switch will return all VLANs defined on the switch, and if the -v vlan option is used, poll-switch will list all MACs learned on that VLAN.

poll-switch supports the following case-insensitive MAC formats:

        0xHHHHHHHHHHHH         HH-HH-HH-HH-HH-HH         HH:HH:HH:HH:HH:HH         HHHH.HHHH.HHHH

OPTIONS

 -a
ARP mode. This option queries the switch (remote agent) for its ARP table. -n network can be used in conjunction with this option to return only those MAC address/IP address pairs that are within the specified network.
 -P
List Ports mode. This option queries the switch (remote agent) for all physical ports configured on the switch.
 -p
Port mode. This option queries the switch (remote agent) for specific port information.
 -V
List VLANs mode. This option queries the switch (remote agent) for all configured VLANs on the switch.
 -v
VLAN mode. This option allows one to query the switch (remote agent) for all hosts learned on the switch across a specific VLAN.
 -h
Print help message.
 -g OID, -w OID
SNMP GET modes. These options allow one to issues a SNMP GET (-g) or GET_NEXT (-w) command to the remote agent.

EXAMPLES

To see what interface (port) a MAC address on cepheus is known on, along with that’s interfaces status:

    ./poll-switch cepheus COMMUNITY_STRING_PASSPHRASE 08:00:46:7a:3e:d0

To see all phsical interfaces on medusa:

    ./poll-switch -P medusa COMMUNITY_STRING_PASSPHRASE

To see the status of the port GigabitEtherenet2/2, and all MACs known on that interface on the switch perseus:

    ./poll-switch -p gi2/2 perseus COMMUNITY_STRING_PASSPHRASE

To see all VLANs configured on the switch andromeda:

    ./poll-switch -V andromeda COMMUNITY_STRING_PASSPHRASE

To see all MAC address known on a particular the .99. VLAN:

    ./poll-switch -v 99 perseus COMMUNITY_STRING_PASSPHRASE

BUGS

poll-switch does not return IPv6 addresses when the -a option is used.

Some Cisco products (e.g., the 4500 family) do not appear to have a published way of retrieving the duplex settings.

Net::SNMP has a bug that corrupts some MAC addresses.

Some Cisco 6500s simply do not respond to some Community String Indexedcommunities (e.g., FiDDI, etc.), initially resulting in the client (poll-switch) timing out. A hack has been added to ignore these VLANs.


AUTHOR

Written by Andrew K. Adams akadams@psc.edu for the Pittsburgh Supercomputing Center.