Use the snmp command to issue SNMP requests to agents and to process SNMP responses returned by agents. This command supports a maximum SNMP response packet size of 65 535 bytes. SNMPv1, SNMPv2c, and SNMPv3 requests are supported.
Use the snmp command with the trap request type to receive and format traps and notifications.
Getting MIB Variables:
.- -d 0-----------. .- -h localhost---. >>-snmp--+-----------------+--+-----------------+---------------> '- -d debug_level-' '- -h target host-' .- -r 2------------. .- -c public----------. >--+------------------+--+---------------------+----------------> '- -r retry number-' '- - c community_name-' .- -t 3-------------. >--+-------------------+--+-----+--+-----+----------------------> '- -t timeout value-' '- -v-' '- -a-' >--+-get-----------------------------------------------------+--> +-getnext-------------------------------------------------+ | .- -m 10--------------. .- -n 0-------------. | '-+---------------------+--+-------------------+--getbulk-' '- -m max repetitions-' '- -n non-repeaters-' .--------------. V | >----mib_variable-+--------------------------------------------><
Setting the MIB Variables:
.- -d 0-----------. .- -h localhost---. >>-snmp--+-----------------+--+-----------------+---------------> '- -d debug_level-' '- -h target host-' .- -r 2------------. .- -c public---------. >--+------------------+--+--------------------+-----------------> '- -r retry number-' '- -c community_name-' .- -t 3-------------. >--+-------------------+--+-----+--+-----+--set-----------------> '- -t timeout value-' '- -v-' '- -a-' .----------------------------------. V | >----mib_variable--+---------+--value-+------------------------>< '-vartype-'
Walking the MIB Tree:
.- -d 0-----------. .- -h localhost---. >>-snmp--+-----------------+--+-----------------+---------------> '- -d debug_level-' '- -h target host-' .- -r 2------------. .- -c public---------. >--+------------------+--+--------------------+-----------------> '- -r retry number-' '- -c community_name-' .- -t 3-------------. >--+-------------------+--+-----+--+-----+----------------------> '- -t timeout value-' '- -v-' '- -a-' >--+-walk-----------------------------------------------------+--> | .- -m 10--------------. .- -n 0-------------. | '-+---------------------+--+-------------------+--bulkwalk-' '- -m max repetitions-' '- -n non-repeaters-' >--mib_variable------------------------------------------------><
Displaying snmp Help:
>>-snmp-- -?---------------------------------------------------><
Receiving a Trap:
.- -d 0-----------. .- -p 162---------. >>-snmp--+-----------------+--+-----------------+--trap-------->< '- -d debug_level-' '- -p port_number-'
Finding a MIB Variable Name:
.- -d 0-----------. >>-snmp--+-----------------+--findname--mib_variable----------->< '- -d debug_level-'
Restriction: You cannot specify scope information as part of the host name or the IP address of the target host.
For more information about the UDPCONFIG statement, see the z/OS Communications Server: IP Configuration Reference.
EZZ3306I Error converting <name> to Entity
The following requests MIB object sysName.0:
snmp get sysName.0
1.3.6.1.2.1.1.5.0 = MVS SNMP
The following requests MIB object myName.0, where myName is defined in the MIBS.DATA file to be the same object identified by sysName.0:
snmp get myName.0
1.3.6.1.2.1.1.5.0 = MVSX SNMPv2 Agent
The following requests the next logical MIB object:
snmp getnext udp
1.3.6.1.2.1.7.1.0 = 653
The following requests the next logical object, using the -v option to have value displayed with textual name instead of object identifier:
snmp -v getnext udp
udpInDatagrams.0 = 653
snmp set sysName.0 "MVSX SNMPv2 Agent"
1.3.6.1.2.1.1.5.0 = MVSX SNMPv2 Agent
snmp set usmUserAuthKeyChange.1.2.2.117.49
\'3eca6ff34b59010d262845210a40165678dd9646e31e9f890480a233dbe1114d\'h
The following returns by name all objects beginning with the same object identifier prefix:
snmp -v walk udp
udpInDatagrams.0 = 13
udpNoPorts.0 = 7
udpInErrors.0 = 0
udpOutDatagrams.0 = 20
udpLocalAddress.0.0.0.0.161 = 0.0.0.0
udpLocalAddress.0.0.0.0.514 = 0.0.0.0
udpLocalAddress.0.0.0.0.4001 = 0.0.0.0
udpLocalAddress.0.0.0.0.50003 = 0.0.0.0
udpLocalAddress.9.42.103.27.1029 = 9.42.103.27
udpLocalPort.0.0.0.0.161 = 161
udpLocalPort.0.0.0.0.514 = 514
udpLocalPort.0.0.0.0.4001 = 4001
udpLocalPort.0.0.0.0.50003 = 50003
udpLocalPort.9.42.103.27.1029 = 1029
udpEndpointProcess.0.0.161.0.0.0.33 = 0
udpEndpointProcess.0.0.514.0.0.0.28 = 0
udpEndpointProcess.0.0.4001.0.0.0.44 = 0
udpEndpointProcess.0.0.50003.0.0.0.70 = 0
udpEndpointProcess.1.4.9.42.103.27.1029.0.0.0.67 = 0
udpEndpointProcess.2.0.4002.2.16.32.1.13.184.0.0.0.0.0.0.0.0.0.0.0.1.9002.45 = 0
udpEndpointProcess.2.16.255.1.0.0.0.0.0.0.0.0.0.0.0.0.1.0.5003.0.0.0.46 = 0
The following returns by name all objects beginning with the same object identifier prefix, but with fewer data packages to be exchanged between the snmp command and the SNMP agent.
The bulkwalk request type is an SNMPv2 function. The -h parameter identifies a host, loopback, defined in the OSNMP.CONF file as an agent that supports SNMPv2 or SNMPv3.
snmp -h loopback -v -m 10 bulkwalk udp
udpInDatagrams.0 = 2125
udpNoPorts.0 = 7
udpInErrors.0 = 0
udpOutDatagrams.0 = 2132
udpLocalAddress.0.0.0.0.161 = 0.0.0.0
udpLocalAddress.0.0.0.0.514 = 0.0.0.0
udpLocalAddress.0.0.0.0.4001 = 0.0.0.0
udpLocalAddress.0.0.0.0.50009 = 0.0.0.0
udpLocalAddress.9.42.103.27.1030 = 9.42.103.27
udpLocalPort.0.0.0.0.161 = 161
udpLocalPort.0.0.0.0.514 = 514
udpLocalPort.0.0.0.0.4001 = 4001
udpLocalPort.0.0.0.0.50009 = 50009
udpLocalPort.9.42.103.27.1030 = 1030
udpEndpointProcess.0.0.161.0.0.0.34 = 0
udpEndpointProcess.0.0.514.0.0.0.36 = 0
udpEndpointProcess.0.0.4001.0.0.0.44 = 0
udpEndpointProcess.0.0.50010.0.0.0.80 = 0
udpEndpointProcess.1.4.9.42.103.27.1031.0.0.0.78 = 0
udpEndpointProcess.2.0.4002.2.16.32.1.13.184.0.0.0.0.0.0.0.0.0.0.0.1.9002.45 = 0
udpEndpointProcess.2.16.255.1.0.0.0.0.0.0.0.0.0.0.0.0.1.0.5003.0.0.0.46 = 0
udpHCInDatagrams.0 = 2125
udpHCOutDatagrams.0 = 2132
The getbulk request type is an SNMPv2 function. The -h parameter identifies a host, loopback, defined in the OSNMP.CONF file as an agent that supports SNMPv2 or SNMPv3.
snmp -h loopback -v -n 2 -m 5 getbulk sysObjectId ifNumber ifName ifHCInOctets ifHCOutOctets
sysObjectID.0 = 1.3.6.1.4.1.2.3.13
ifNumber.0 = 31
ifName.1 = LOOPBACK
ifHCInOctets.1 = 108028
ifHCOutOctets.1 = 108028
ifName.2 = LOOPBACK
ifHCInOctets.2 = 107868
ifHCOutOctets.2 = 107868
ifName.3 = LOOPBACK6
ifHCInOctets.3 = 160
ifHCOutOctets.3 = 160
ifName.4 = LCS1
ifHCInOctets.4 = 0
ifHCOutOctets.4 = 0
ifName.5 = TR1
ifHCInOctets.5 = 0
ifHCOutOctets.5 = 0
snmp findname 1.3.6.1.2.1.6.13.1.2
1.3.6.1.2.1.6.13.1.2 found as: tcpConnLocalAddress
snmp findname 1.3.6.1.2.1.6.13.1.2.0
1.3.6.1.2.1.6.13.1.2.0 found as: tcpConnLocalAddress.0
snmp findname 1.3.6.1.2.
1.3.6.1.2. found as: mgmt
By default, the snmp command no longer sets the SO_IGNORESOURCEVIPA socket option to force the originating address in the request packet to be that of the physical interface over which the packet is sent. A source VIPA address, if one is configured, is used instead. To cause the snmp command to use the physical address instead, the -a option can be specified. This implies that the SNMP agent receiving the request must be configured to accept requests from the physical interface address rather than the source VIPA address.
snmp -a get sysUpTime.0
1.3.6.1.2.1.1.3.0 = 2950600
snmp -h hostA get sysUpTime.0
1.3.6.1.2.1.1.3.0 = 2950600