Description

This article provides information about the Simple Network Management Protocol (SNMP) remote operation on Junos OS.

Symptoms

RFC 2925 defines the Management Information Database (MIBs) for performing remote ping, traceroute, and lookup operations on a remote host. Currently, Junos OS supports two SNMP remote operations: ping and traceroute.

Solution

To use the SNMP remote operation, you ought to configure an SNMP community with authentication read-write on Junos OS.

  1. Set the SNMP view:

root# show snmp 
view remote-vie {
    oid 1.3.6.1.2.1.80 include;             # pingMIB
    oid 1.3.6.1.4.1.2636.3.7 include;       # jnxPingMIB
    oid 1.3.6.1.2.1.81 include;             # traceRouteMIB
    oid 1.3.6.1.4.1.2636.3.8 include;       # jnxTraceRouteMIB
}
  1. Set the SNMP community:

community ping {
    view remote-vie;
    authorization read-write;
}     

These parameters must be set before SNMP ping is enabled:

  • pingCtlRowStatus - oid:.1.3.6.1.2.1.80.1.2.1.23

  • pingCtlOwnerIndex - oid:.1.3.6.1.2.1.80.1.2.1.1 --- not accessible

  • pingCtlTestName - oid:.1.3.6.1.2.1.80.1.2.1.2 --- not accessible

  • pingCtlTargetAddressType - oid:.1.3.6.1.2.1.80.1.2.1.3

  • pingCtlTargetAddress - oid:.1.3.6.1.2.1.80.1.2.1.4

Notice that pingCtlOwnerIndex and pingCtlTestName cannot be accessed. To reference the pingCtlTargetAddress variable of a row in pingCtlTable, in which pingCtlOwnerIndex and pingCtlTestName are test, use the following object identifier:

pingMIB.pingObjects.pingCtlTable.pingCtlEntry.pingCtlTargetAddress."test"."test"  
 =   .1.3.6.1.2.1.80.1.2.1.8.  4.116.101.115.116.4.116.101.115.116  

The first test string represents pingCtlOwnerIndex (translated to UTF8 as 4.116.101.115.116) - 4 means string length and 116.101.115.116 means test. The secondary test string represents pingCtlTestName.

 

To enable remote ping on the SNMP manager, perform this procedure:

  1. Set pingCtlRowStatus to create-and-wait:

[root@lab-svr-2 ~]# snmpset -v 1 -c ping -d 172.27.103.32 .1.3.6.1.2.1.
80.1.2.1.23.4.116.101.115.116.4.116.101.115.116 i 5
pingCtlRowStatus known values:
1 --- active
2 --- not in service
3 --- not ready
4 --- create and go
5 --- create and wait
6 --- destroy 
  1. Set pingCtlTargetAddressType to IPv4:

[root@lab-svr-2 ~]# snmpset -v 1 -c ping -d 172.27.103.32 .1.3.6.1.2.1.80.1.2.1
.3.4.116.101.115.116.4.116.101.115.116 i 1
pingCtlTargetAddressType known values:
1 --- ipv4
2 --- ipv6
3 --- ipv4z
4 --- ipv6z
16--- dns
  1. Set pingCtlTargetAddress to target the IPv4 address (172.27.103.1) tag that is represented by Hex:

[root@lab-svr-2 ~]# snmpset -v 1 -c ping -d 172.27.103.32 .1.3.6.1.2.1.80.1.2.
1.4.4.116.101.115.116.4.116.101.115.116 x "AC 1B 67 01"
  1. (Optional) Set pingCtlFrequency (oid:.1.3.6.1.2.1.80.1.2.1.10); the number of seconds to wait before repeating a ping test, as defined by the value of the various objects in the corresponding row. A value of 0 for this object implies that the test as defined by the corresponding entry will not be repeated:

[root@lab-svr-2 ~]# snmpset -v 1 -c ping -d 172.27.103.32 .1.3.6.1.2.1.80.1.2.1.10
.4.116.101.115.116.4.116.101.115.116 u 1
  1. (Optional) Set pingCtlProbeCount (oid:.1.3.6.1.2.1.80.1.2.1.7); the number of probes used to calculate the average, maximum, and minimum value:

[root@lab-svr-2 ~]# snmpset -v 1 -c ping -d 172.27.103.32 .1.3.6.1.2.1.80.1.2.1.7
.4.116.101.115.116.4.116.101.115.116 i 5
  1. Set pingCtlRowStatus to active:

[root@lab-svr-2 ~]# snmpset -v 1 -c ping -d 172.27.103.32 .1.3.6.1.2.1.80.1.2.1.
23.4.116.101.115.116.4.116.101.115.116 i 1
  1. Set pingCtlAdminStatus (oid:.1.3.6.1.2.1.80.1.2.1.8) to enable remote ping start:

[root@lab-svr-2 ~]# snmpset -v 1 -c ping -d 172.27.103.32 .1.3.6.1.2.1.80.
1.2.1.8.4.116.101.115.116.4.116.101.115.116 i 1
pingCtlAdminStatus known values:
1 --- enable
2 --- disable
  1. Stop the remote ping:

[root@lab-svr-2 ~]# snmpset -v 1 -c ping -d 172.27.103.32 
.1.3.6.1.2.1.80.1.2.1.8.4.116.101.115.116.4.116.101.115.116 i 2

If snmp v2 is configured and being used, the snmpset command will be like "snmpset -v 2c -c community-name -d xxx". The remaining part that is represented by "xxx" will be the same as those for snmp v1.

The above operation is similar to the following actions:

  • Telnet to 172.27.103.32.

  • ping inet 172.27.103.1 count 5 interval 1

Sample remote ping test result:

Note: Enable the service rpm to active snmp remote ping: set services rpm.

root# run show snmp mib walk .1.3.6.1.2.1.80.1    
pingMaxConcurrentRequests.0 = 100
pingCtlTargetAddressType.4.116.101.115.116.4.116.101.115.116 = 1 
-> Protocol Type : IPv4
pingCtlTargetAddress.4.116.101.115.116.4.116.101.115.116 = ac 1b 67 01  
-> Target IP Address : 172.27.103.1
pingCtlDataSize.4.116.101.115.116.4.116.101.115.116 = 0
pingCtlTimeOut.4.116.101.115.116.4.116.101.115.116 = 3
pingCtlProbeCount.4.116.101.115.116.4.116.101.115.116 = 5               
-> Number of probe : 5
pingCtlAdminStatus.4.116.101.115.116.4.116.101.115.116 = 1
pingCtlDataFill.4.116.101.115.116.4.116.101.115.116 = 00 
pingCtlFrequency.4.116.101.115.116.4.116.101.115.116 = 1                
-> How often to send ping packet : 1 sec
pingCtlMaxRows.4.116.101.115.116.4.116.101.115.116 = 50
pingCtlStorageType.4.116.101.115.116.4.116.101.115.116 = 2
pingCtlTrapGeneration.4.116.101.115.116.4.116.101.115.116 = 00 
pingCtlTrapProbeFailureFilter.4.116.101.115.116.4.116.101.115.116 = 0
pingCtlTrapTestFailureFilter.4.116.101.115.116.4.116.101.115.116 = 0
pingCtlType.4.116.101.115.116.4.116.101.115.116 = pingIcmpEcho          
-> Probe Type
pingCtlDescr.4.116.101.115.116.4.116.101.115.116 = 00 
pingCtlSourceAddressType.4.116.101.115.116.4.116.101.115.116 = 1
pingCtlSourceAddress.4.116.101.115.116.4.116.101.115.116
pingCtlIfIndex.4.116.101.115.116.4.116.101.115.116 = 0
pingCtlByPassRouteTable.4.116.101.115.116.4.116.101.115.116 = 2
pingCtlDSField.4.116.101.115.116.4.116.101.115.116 = 0
pingCtlRowStatus.4.116.101.115.116.4.116.101.115.116 = 1
pingResultsOperStatus.4.116.101.115.116.4.116.101.115.116 = 1
pingResultsIpTargetAddressType.4.116.101.115.116.4.116.101.115.116 = 0
pingResultsIpTargetAddress.4.116.101.115.116.4.116.101.115.116
pingResultsMinRtt.4.116.101.115.116.4.116.101.115.116 = 2               
-> Minimum Round Trip Time
pingResultsMaxRtt.4.116.101.115.116.4.116.101.115.116 = 4               
-> Maximum Round Trip Time
pingResultsAverageRtt.4.116.101.115.116.4.116.101.115.116 = 3           
-> Average Round Trip Time
pingResultsProbeResponses.4.116.101.115.116.4.116.101.115.116 = 5
pingResultsSentProbes.4.116.101.115.116.4.116.101.115.116 = 5
pingResultsRttSumOfSquares.4.116.101.115.116.4.116.101.115.116 = 99
pingResultsLastGoodProbe.4.116.101.115.116.4.116.101.115.116 = 07 dc 0c 19  03 18 30 00  2b 00 00 
pingProbeHistoryResponse.4.116.101.115.116.4.116.101.115.116.1 = 3
pingProbeHistoryResponse.4.116.101.115.116.4.116.101.115.116.2 = 3
pingProbeHistoryResponse.4.116.101.115.116.4.116.101.115.116.3 = 2
pingProbeHistoryResponse.4.116.101.115.116.4.116.101.115.116.4 = 3      
-> 1st result of last 5 probes
pingProbeHistoryResponse.4.116.101.115.116.4.116.101.115.116.5 = 4      
-> 2nd result of last 5 probes
pingProbeHistoryResponse.4.116.101.115.116.4.116.101.115.116.6 = 3      
-> 3rd result of last 5 probes
pingProbeHistoryResponse.4.116.101.115.116.4.116.101.115.116.7 = 2      
-> 4th result of last 5 probes
pingProbeHistoryResponse.4.116.101.115.116.4.116.101.115.116.8 = 3      
-> 5th result of last 5 probes
pingProbeHistoryStatus.4.116.101.115.116.4.116.101.115.116.1 = 1
pingProbeHistoryStatus.4.116.101.115.116.4.116.101.115.116.2 = 1
pingProbeHistoryStatus.4.116.101.115.116.4.116.101.115.116.3 = 1
pingProbeHistoryStatus.4.116.101.115.116.4.116.101.115.116.4 = 1
pingProbeHistoryStatus.4.116.101.115.116.4.116.101.115.116.5 = 1
pingProbeHistoryStatus.4.116.101.115.116.4.116.101.115.116.6 = 1
pingProbeHistoryStatus.4.116.101.115.116.4.116.101.115.116.7 = 1
pingProbeHistoryStatus.4.116.101.115.116.4.116.101.115.116.8 = 1        
-> 1 = "received", 4 = "request Timeout"

Modification History

2021-08-14: Added note to enable service rpm

2023-03-30: Added snmpset v2 commands

Related Information

Configuring SNMP Remote Operations