Setting Router Information for the MIB-II System Group
Problem
You need to define specific information about the router, such as its name and location, to pass to the SNMP manager.
Solution
Set description, location, and contact information about the router:
[edit snmp] aviva@router1# set description "JUNOS cookbook M20, aka router1" aviva@router1# set location "JUNOS cookbook kitchen" aviva@router1# set contact "aviva at extension 12345"
Discussion
These commands provide general information, which is placed into objects in the MIB-II system group, about the router to the SNMP manager. The description string identifies the router and is placed into the sysDescription object. The location describes the router's physical location and is placed into the sysLocation object. The contact identifies how to contact the router's administrator and goes into the sysContact object. The name of the router you configured when you installed the router (the name in the set system host-name command) is placed into the sysName object. You can set a different router name to be used just for SNMP:
[edit snmp] aviva@router1# set name junos-cookbook-router
You can use a utility like snmpwalk from a Unix workstation to retrieve the agent's information. ( snmpwalk uses SNMP GetNext requests to query a network entity for a tree of information.) The following command uses the hostname of the agent (router1), but you can also use the IP address:
aviva-server> snmpwalk -c public router1 system.sysDescr system.sysDescr.0 = JUNOS cookbook M20, aka router1 aviva-server> snmpwalk -c public router1 system.sysContact system.sysContact.0 = aviva at extension 12345
You can also get this information on the router itself. The following command shows all the settings in the system MIB:
aviva@router1> show snmp mib walk system sysDescr.0 = JUNOS cookbook M20, aka router1 sysObjectID.0 = jnxProductNameM20 sysUpTime.0 = 2888368 sysContact.0 = aviva at extension 12345 sysName.0 = junos-cookbook-router sysLocation.0 = JUNOS cookbook kitchen sysServices.0 = 4
You can also look at a single MIB object:
aviva@router1> show snmp mib get sysDescr.0 sysDescr.0 = JUNOS cookbook M20, aka router1
In this command, specify both the name of the object and the instance, which is 0. Similarly, you can look at more than one object:
aviva@router1> show snmp mib get "sysUpTime.0 sysName.0" sysUpTime.0 = 2865092 sysName.0 = router1
For this command to work, make sure to enclose the list of objects in quotation marks.
See Also
Recipe 1.1