When trying to diagnose network problems one of the questions I always ask is “What is the status of the switch port that is connected to the module’s interface?” The typical answer is “I need to ask the network people”. Now using the magic of Simple Network Management Protocol (SNMP) and the attached command macro it may not be necessary to ask.
All manageable switches (and this includes routers that also act as switches) respond to SNMP requests. The SNMP protocol is protected by a password, known as the community string. There is typically a password for reading and another for writing. I can certainly understand your network people not wanting to give you the write community string but if you ask nicely they may give you the read string. After all, there should be no harm in reading and if you can do it yourself, you do not have to bother them. However, before asking you might want to try the standard default string which is “public”. If it works, no need to even ask.
SNMP data is organized by MIBs (Management Information Base). The “Interfaces” table is in the MIB-II MIB which is supported by, dare I say, all devices that support SNMP. The table includes error, byte and packet counters. It is not a lot of information but it is enough to determine the basic health of the connection between your module’s interface and the network. The interfaces MIB is documented in RFC-1213 “Management Information Base for Network Management of TCP/IP-based internets: MIB-II” You can find a copy at http://www.ietf.org/rfc/rfc1213.txt.
The macro gives you three ways to identify the individual port on the switch to query. The first is by interface name. Using the name it uses the netstat command to determine the MAC address of the interface and queries the switch’s forwarding table to determine which port is associated with the MAC address.
get_switch_interface_stats 172.16.1.222 #sdlmux.m16.11-3
The IP address that precedes the name is the IP address of the switch.
You can also provide the MAC address in the form XX-XX-XX-XX-XX-XX. This is one way to look at the standby adapter’s switch connection.
get_switch_interface_stats 172.16.1.222 00-00-a8-44-52-22 -type mac
Finally you can just provide the port index. Depending on the switch this may be the actual port number or something based on the port number. In the following example the port number is 48 but the index is 1048.
get_switch_interface_stats.cm 172.16.1.222 1048 -type port
In the following example output you will notice that the timestamps between the first and second passes are slightly more than 60 seconds apart. This is because the timestamp is printed before the queries are made and the queries take time.
Why are there two passes? The counters are not normally cleared so a single value doesn’t give you any idea of how fast the counters are changing. The macro displays both the first and second values and does the subtraction for you.
Under ideal circumstances there are never any errors or discards so if these counters are non-zero the cause should be investigated. The packet counts give you an idea of volume. If there is an unusually low volume of outgoing packets (packets going from the switch to the interface) you know there may be an issue with the switch’s connection to the rest of the network. An unusually high non-unicast outgoing packet count may indicate that some host on the network is flooding the network with broadcasts or multicasts. If the incoming packet count is low you have to ask why the application(s) on the module are not transmitting at the expected rate. The key here is knowing what is unusual and that requires creating a baseline.
The only unambiguous values are the administrative and operational status. If operational status shows down you know there is a problem with the connection between the switch and the interface. If administrative status shows down you know that someone disabled your network connection.
If the link is down how can you query the switch port to know that the link is down? You can query the switch using either the mac address or port index from another module. However, if the link has been down for some time it is possible that the MAC address has been purged from the switch’s forwarding table. If that is the case you will need to use the port index form of the command.
The SNMP commands are found in the >system>maint_library. They are a port of the NET-SNMP commands and documentation can be found at http://www.net-snmp.org/. Note that it is not necessary to be running the SNMP server (snmpd) on the module to run these commands against the switch.