Recording Important Router Information for SNMP Access
Problem
You want to record important information, such as physical locations, contact names, and serial numbers for later SNMP access.
Solution
To record important physical information regarding the router, use the following commands:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#snmp-server contact Ian Brown 416-555-2943
Router(config)#snmp-server location 999 Queen St. W., Toronto, Ont.
Router(config)#snmp-server chassis-id JAX123456789
Router(config)#end
Router#
Discussion
It is an extremely good network management practice to add useful information such as contact names, router locations, and serial numbers directly into the router configuration. This information can be extracted later using snmpget requests, either directly or invoked from scripts that make output easier to understand. This is true not only for Cisco routers, of course. Any time you have to manage remote equipment, you should configure important information like serial numbers and locations so that you can read it with SNMP. When a field technician swaps or moves a piece of equipment, they can update this information. So this way you can easily verify the information you store in your central equipment inventory database.
When you save the contact name, router location, and serial number in the router configuration like this, it is also easy to extract from the command line and configuration files as well:
Router#show snmp
Chassis: JAX123456789
Contact: Ian Brown 416-555-2943
Location: 999 Queen St. W., Toronto, Ontario
417 SNMP packets input
0 Bad SNMP version errors
141 Unknown community name
3 Illegal operation for community name supplied
0 Encoding errors
224 Number of requested variables
49 Number of altered variables
224 Get-request PDUs
0 Get-next PDUs
52 Set-request PDUs
299 SNMP packets output
0 Too big errors (Maximum packet size 1500)
3 No such name errors
0 Bad values errors
0 General errors
276 Response PDUs
23 Trap PDUs
SNMP logging: enabled
Logging to 172.25.1.1.162, 0/10, 21 sent, 2 dropped.
Router#
You can also extract individual pieces of information by using the following commands:
Router#show snmp contact
Ian Brown 416-555-2943
Router#show snmp location
999 Queen St. W., Toronto, Ontario
Router#show snmp chassis
JAX123456789
Router#
It is also useful to extract this information from a backup of the router's configuration file. It is a good network management practice to keep a backup copy of every router's configuration on a central server such as the NMS. Then you can extract vital information like the router's serial number. You will often need this information for service and support when a device fails. Of course, when a device fails, you can't reach it through SNMP, so it can be invaluable to be able to get this information from the backup configuration file. On a Unix server, you can use the grep utility to easily extract the required information:
Freebsd% grep snmp-server Router.confg
snmp-server community ORARO RO
snmp-server community ORARW RW
snmp-server location 999 Queen St. W., Toronto, Ontario
snmp-server contact Ian Brown 416-555-2943
snmp-server chassis-id JAX123456789
snmp-server host 172.25.1.1 ORATRAP
Freebsd%
If the router is reachable, you can also extract this information via SNMP:
Freebsd% snmpget v1 -c ORARO Router .1.3.6.1.2.1.1.6.0
system.sysLocation.0 = 999 Queen St. W., Toronto, Ontario
Freebsd% snmpget v1 -c ORARO Router .1.3.6.1.2.1.1.4.0
system.sysContact.0 = Ian Brown 416-555-2943
Freebsd% snmpget v1 -c ORARO Router .1.3.6.1.4.1.9.3.6.3.0
enterprises.9.3.6.3.0 = "JAX123456789"
Freebsd%