Use SNMP Trace Operations to Monitor a Router
Purpose
Tracing operations record more detailed messages about the operation of SNMP, such as the various types of routing protocol packets sent and received, and routing policy actions. In this topic, traceoptions are configured on a router, a MIB object is queried through a network management station, and the action of the query is verified with a log file on the router.
![]() | Note: Traceoptions, in general, requires extra router resources. It is recommended that you do not leave it on permanently. |
To use SNMP traceoptions to monitor a router, follow these steps:
- Configure Trace Operations for SNMP
- Query a MIB With SNMPGet
- Display the Output for SNMP Trace Operations
Configure Trace Operations for SNMP
Purpose
Define tracing for SNMP to access more granular information about the packets sent and received through SNMP.
Action
To configure SNMP tracing operations, follow these steps:
- In configuration mode, go to the following hierarchy level:[edit]user@R1# edit snmp
- Configure trace operations:[edit snmp]user@R1# set traceoptions flag pdu
- Commit the configuration:user@R1# commit and-quit commit completeExiting configuration mode
Sample Output
user@R1> show configuration
snmp view all {
oid .1 include;
}
view system {
oid system;
}
community public {
view all;
authorization read-only;
}
community private {
view system;
authorization read-write;
}
traceoptions {
flag pdu;
}
Meaning
The sample output shows a configuration for SNMP that includes traceoptions. The pdu flag is configured, which results in the generation of SNMP request and response packets. The output for the tracing operation is placed into various log files in the /var/log directory.
Protocol-specific tracing operations override any equivalent operations that you specify in the global traceoptions statement. If there are no equivalent operations, they supplement the global tracing options. If you do not specify any protocol-specific tracing, the routing protocol inherits all the global tracing operations.
Query a MIB With SNMPGet
Purpose
Send an SNMP request to check that the SNMP configuration is correct.
Action
To query a MIB with SNMPGet, enter the following command:
Sample Output
user-nms % snmpget tp1 public .1.3.6.1.2.1.1.1.0 system.sysDescr.0 = m7i internet router, kernel 6.0R1.5 user-nms % snmpget tp1 public sysDescr.0 system.sysDescr.0 = m7i internet router, kernel 6.0R1.5
Meaning
The sample output shows a query from a network management station (nms) for the description of the system running on the router tp1. The OID is entered in numerical form in the command line, and a description (sysDescr.0) is obtained in the output. You can also use sysDescr.0 in the command line to obtain the same output.
Display the Output for SNMP Trace Operations
Purpose
The SNMP log file shows more granular information about the packets sent and received through SNMP. In this step, the contents of the SNMP log file snmpd are displayed to verify that both the GetRequest and the GetResponse packets appear in the output.
Action
To display the output for trace operations, enter the following Junos OS command-line interface operational mode command:
Sample Output
user@R1> show log snmpd [...Output truncated...} Jan 21 16:32:32 snmpd[28b6fdb3] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Jan 21 16:32:32 snmpd[28b6fdb3] >>> Get-Request Jan 21 16:32:32 snmpd[28b6fdb3] >>> Source: 172.17.28.131 Jan 21 16:32:32 snmpd[28b6fdb3] >>> Destination: 10.168.70.143 Jan 21 16:32:32 snmpd[28b6fdb3] >>> Version: SNMPv1 Jan 21 16:32:32 snmpd[28b6fdb3] >>> Request_id: 0x28b6fdb3 Jan 21 16:32:32 snmpd[28b6fdb3] >>> Community: public Jan 21 16:32:32 snmpd[28b6fdb3] >>> Error: status=0 / vb_index=0 Jan 21 16:32:33 snmpd[28b6fdb3] >>> OID : sysDescr.0 Jan 21 16:32:33 snmpd[28b6fdb3] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Jan 21 16:32:33 snmpd[28b6fdb3] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Jan 21 16:32:33 snmpd[28b6fdb3] <<< Get-Response Jan 21 16:32:33 snmpd[28b6fdb3] <<< Source: 10.168.70.143 Jan 21 16:32:33 snmpd[28b6fdb3] <<< Destination: 172.17.28.131 Jan 21 16:32:33 snmpd[28b6fdb3] <<< Version: SNMPv1 Jan 21 16:32:33 snmpd[28b6fdb3] <<< Request_id: 0x28b6fdb3 Jan 21 16:32:33 snmpd[28b6fdb3] <<< Community: public Jan 21 16:32:33 snmpd[28b6fdb3] <<< Error: status=0 / vb_index=0 Jan 21 16:32:33 snmpd[28b6fdb3] <<< OID : sysDescr.0 Jan 21 16:32:33 snmpd[28b6fdb3] <<< type : OctetString Jan 21 16:32:33 snmpd[28b6fdb3] <<< value: "m7i internet router, kernel 6.0R Jan 21 16:32:33 snmpd[28b6fdb3] <<< 1.5" Jan 21 16:32:33 snmpd[28b6fdb3] <<< HEX : 6d 37 69 20 69 6e 74 65 Jan 21 16:32:33 snmpd[28b6fdb3] <<< 72 6e 65 74 20 72 6f 75 Jan 21 16:32:33 snmpd[28b6fdb3] <<< 74 65 72 2c 20 6b 65 72 Jan 21 16:32:33 snmpd[28b6fdb3] <<< 6e 65 6c 20 36 2e 30 52 Jan 21 16:32:33 snmpd[28b6fdb3] <<< 31 2e 35 Jan 21 16:32:33 snmpd[28b6fdb3] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [...Output truncated...]
Meaning
The sample output shows the contents of the snmpd log file, with all of the packets sent and received through SNMP. The Get-Request packet is sent from a network management station and the Get-Response packet is sent from tp1. The value in the Get-response packet is the same as that returned to the network management station in Step 2, m7i internet router, kernel 6.0R1.5.
Hide Navigation Pane
Show Navigation Pane
SHA1
