TheAIX® clsnmp command provides the SNMP manager function from the AIX shell to query SNMP agents for network management information.
clsnmp [ -d DebugLevel ] [ -h TargetHost ] [ -c Community ] [ -t TimeOutValue ] [ -r RetryNumber ] [ -n NonRepeaters ] [ -m MaxRepetitions ] [ -p PortNumber ] [ -v ] [ -f ConfigurationFile ] [ -? ] Function [ MIBVariable [ VariableType ] [ Value ] [ ... ] ]
Use the clsnmp command to issue SNMP requests to agents and to process SNMP responses returned by agents. The AIX clsnmp commands supports issuance of SNMPv1, SNMPv2c, and SNMPv3 requests.
SNMP request types
Usage
The set operation is not supported on all MIB objects. The set operation may be rejected if the agent or subagents managing the MIB object does not support SET.
getbulk is an SNMPv2 function. If the target agent only supports SNMPv1, the target agent ignores your request. As a result, your request times out.
The function keywords are not case sensitive. The flags, variable names and values are case sensitive.
In order to listen to traps from NetView® SNMP and AIX clsnmp at the same time, use the -p PortNumber parameter on the clsnmp command. Only one management application at an IP address can listen on a port at a time. Specifying -p on the clsnmp trap command enables a port other than well-known port 162 to be used. Both ports must be configured as agent trap destinations.
An clsnmp command that is not authenticated (by using an acceptable community name or user name) will time out.
The clsnmp command uses two configuration files: /etc/mib.defs and clsnmp.conf. Sample files are shipped in the /usr/samples/snmpdv3 directory.
The clsnmp command supports sending SNMPv1, SNMPv2c, and SNMPv3 requests. The file clsnmp uses to determine whether it should send an SNMPv1,SNMPv2c or SNMPv3 request is the clsnmp.conf file. If the target specified by way of the -h parameter matches a winSNMP name in the clsnmp.conf file, clsnmp sends the request using the parameters specified on the entry. If the -h parameter is not specified, then the request will be sent as an SNMPv1request.
| Item | Description | 
|---|---|
| -c Community | Specifies the community name used to access
the specified variables  at the destination SNMP agent. If you do
not specify a community name, the  default name is public. Community
names are not required when using the  user-based security model. Note: Community names are case sensitive. | 
| -d DebugLevel | Specifies the debug level. The default level is 0, which means no debug. The higher the debug level, the greater the number of messages that are displayed. The debug levels are 0-4. | 
| -f ConfigurationFile | Specifies the full path and file name of the configuration file. | 
| -h TargetHost | Specifies the target host to which you want to send a request. The host can be an IPv4 address, an IPv6 address, a host name, or a winSNMP name in the clsnmp.conf configuration file. If you do not specify a host, the default is your local host. | 
| -m MaxRepetitions | Only applies to getbulk. This is ignored if the function request is not a getbulk. Maximum repetitions is the number of lexicographic successors to be returned for each variable binding pair after the first "-n number" successors. For example, starting with successor "-n number"+1, return "-m number" of successors for each variable binding pair. The default is 10. | 
| -n NonRepeaters | Only applies to getbulk requests. This is ignored if the function request is not a getbulk. NonRepeaters is the number of variable binding pairs (name/value), starting with the first, for which only a single successor is returned. The default is 0. | 
| -p PortNumber | Specifies the number of the port that listens for traps. If a port number is not specified, the clsnmp trap function listens on the well-known port 162, the default port for clsnmp traps. | 
| -r RetryNumber | Specifies the maximum number of times to retry the command if it timed out. The default is 2. | 
| -t TimeOutValue | Specifies the amount of time (in seconds) that the clsnmp command waits for a reply from the SNMP agent. The default is 3. | 
| -v | Specifies that the output from a request should be displayed using verbose output, for example, using the textual name instead of the MIB object identifier. | 
| -? | Displays help information. | 
| Item | Description | 
|---|---|
| Function | Specifies the SNMP function/operation to perform, which is one of the following: get, getnext, getbulk, set, walk, trap, findname. | 
| MIBVariable | Specifies the Management Information Base (MIB) object, using its object descriptor (textual name), object identifier in ASN.1 notation, or a combination of the two. When used with walk, this is the MIB object prefix. A prefix can be any leading portion of the complete object identifier. When used with findname, this is the object identifier in ASN.1 notation. | 
| Value | Specifies the value to be set by the SET function. If white space is needed in the value, you must enclose the value in double quotes ("). If you want to set a variable to a value that is also a type, you must specify the type. | 
| VariableType | Specifies the type of value being set. To complete an SNMP
SET request, the  SMI_type must be known. If no type is specified, clsnmp searches first the  /etc/mib.defs file and then
the compiled MIB to determine the type. If the  variable is not found,
an error is returned. If a VariableType is specified, the  VariableType
takes precedence over any type that may be assigned in the MIB. The
 VariableType and value must be compatible. For example, if you specify
a type of  "number" and a value of "foo," an error is returned because
"foo" is not a  number. VariableType is not case sensitive.
Valid variable types are: 
 | 
When the snmpdv3 daemon encounters SMI-v2 data type MIB while processing a SNMPv1 protocol request from the clsnmp manager, it skips the MIB until it finds a SMI-v1 data type MIB.
The clsnmp manager should be configured with SNMPv2 type requests or SNMPv3 type requests to dump all of the MIB variables with the snmpdv3 daemon.
clsnmp get sysName.01.3.6.1.2.1.1.5.0 = hostname.austin.ibm.comclsnmp get myName.01.3.6.1.2.1.1.5.0 = myhostname.austin.ibm.comclsnmp -h 2000:1:1:1:209:6bff:feae:6d67 get sysName.01.3.6.1.2.1.1.5.0 = hostname.austin.ibm.comclsnmp getnext udp1.3.6.1.2.1.7.1.0 = 653clsnmp -v getnext udpudpInDatagrams.0 = 653clsnmp set sysName.0  "hostname.austin.ibm.com"1.3.6.1.2.1.1.5.0 = hostname.austin.ibm.comclsnmp set sysName.0 displayname "hostname.austin.ibm.com"1.3.6.1.2.1.1.5.0 = hostname.austin.ibm.comclsnmp -h loopback -v -m 10 bulkwalk udpclsnmp -v walk udp 
udpInDatagrams.0 = 653 
udpNoPorts.0 = 22 
udpInErrors.0 = 0 
udpOutDatagrams.0 = 678 
udpLocalAddress.0.0.0.0.7 = 0.0.0.0 
udpLocalAddress.0.0.0.0.9 = 0.0.0.0 
udpLocalAddress.0.0.0.0.13 = 0.0.0.0 
udpLocalAddress.0.0.0.0.19 = 0.0.0.0 
udpLocalAddress.0.0.0.0.37 = 0.0.0.0 
udpLocalAddress.0.0.0.0.161 = 0.0.0.0 
udpLocalAddress.0.0.0.0.5020 = 0.0.0.0 
udpLocalPort.0.0.0.0.7 = 7 
udpLocalPort.0.0.0.0.9 = 9 
udpLocalPort.0.0.0.0.13 = 13 
udpLocalPort.0.0.0.0.19 = 19 
udpLocalPort.0.0.0.0.37 = 37 
udpLocalPort.0.0.0.0.161 = 161 
udpLocalPort.0.0.0.0.5020 = 5020clsnmp -h loopback -v -n 2 -m 5 getbulk sysLocation ifTable tcp udp icmpsysLocation.0 = Research Triangle Park, NC 
ifIndex.1 = 1 
tcpRtoAlgorithm.0 = 4 
udpInDatagrams.0 = 782 
icmpInMsgs.0 = 22 
tcpRtoMin.0 = 0 
udpNoPorts.0 = 22 
icmpInErrors.0 = 0 
tcpRtoMax.0 = 120 
udpInErrors.0 = 0 
icmpInDestUnreachs.0 = 22 
tcpMaxConn.0 = -1 
udpOutDatagrams.0 = 807 
icmpInTimeExcds.0 = 0 
tcpActiveOpens.0 = 1 
udpLocalAddress.0.0.0.0.7 = 0.0.0.0 
icmpInParmProbs.0 = 0clsnmp findname 1.3.6.1.2.1.6.13.1.21.3.6.1.2.1.6.13.1.2 found as: tcpConnLocalAddressclsnmp findname 1.3.6.1.2.1.6.13.1.2.01.3.6.1.2.1.6.13.1.2.0 found as: tcpConnLocalAddress.0clsnmp findname 1.3.6.1.2.1.3.6.1.2. found as: mgmttarget1   9.3.149.26 snmpv3 u1 -          - AuthNoPriv   HMAC-SHA
76784e5935acd6033a855df1fac42acb187aa867 -   -clsnmp -v -h target1 get sysName.0sysName.0 = somehostname.austin.ibm.comclsnmp trap| Item | Description | 
|---|---|
| /etc/clsnmp.conf | Configuration file for the clsnmp command. | 
| /etc/mib.defs | Defines the Management Information Base (MIB) variables the SNMP agent and manager should recognize and handle. |