[ Bottom of Page | Previous Page | Next Page | Contents | Index |  Library Home |
Legal |
Search ]
Commands Reference, Volume 1
clsnmp Command
Purpose
The AIX clsnmp command provides the SNMP manager
function from the AIX shell  to query SNMP agents for network management information.
Syntax
clsnmp [ -d DebugLevel ] [ -h TargetHost ] [ -c Community ] [ -t TimeOutValue ] [ -r RetryNumber ] [ -n NonRepeaters ] [ -m MaxRepetitions ] [ -p PortNumber ] [ -v ] [ -f ConfigurationFile ] [ -? ] Function [ MIBVariable [ VariableType ] [ Value ] [ ... ] ]
Description
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
- findname
- Sends a request that a search be done to obtain the textual name, for
a given  MIBVariable input, whose internal ASN.1 value
best matches the input ASN.1  value. The search first checks the /etc/mib.defs file, and if a matching  textual name is not found, continue
with the compiled MIB. Only one MIBVariable is allowed
per clsnmp findname invocation.
- get
- Sends a request to an SNMP agent for a specific management information
base  (MIB) variable. clsnmp then waits for a response
or times out.
- getbulk
- Obtains the value of the variables in the MIB tree specified by the
OID or  MIB variable name. A single getbulk performs
the same function as a series of  getnexts with fewer
data exchanges between the clsnmp command and the SNMP
 agent.
- getnext
- Sends a request to an SNMP agent for the next MIB variable that  lexicographically
follows the MIBVariable specified. clsnmp then waits for a response or times out.
- set
- Sends a request to an SNMP agent to set a specific MIB variable. clsnmp then  waits for a response or times out.
- trap
- Listens for SNMP traps and displays trap information
when they occur. Uses  the default, well-known port 162 or the port number
specified on the -p option. The clsnmp trap function continues to listen for traps until the process is  killed
or canceled.
- walk
- Issues a getnext request for a specified prefix,
then continues to issue  getnext requests for as long
as there are variables that match the specified  prefix. A prefix can be any
leading portion of the complete object identifier.
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.
Flags
| -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. This
can be an  internet protocol 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. | 
Parameters
| 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: 
bitstringcountercounter32counter64display or displaystringgaugegauge32integerinteger32ipaddressnsapaddressnullobjectidentifier or OIDoctetstringopaqueopaqueasciitimeticksuinteger | 
Examples
- Getting the MIB variable.
- The following requests MIB object sysName.0:
clsnmp get sysName.0 The output from this command looks similar to:1.3.6.1.2.1.1.5.0 = hostname.austin.ibm.com 
- The following requests MIB object myName.0, where myName is defined in
the /etc/mib.defs file to be the same object identified
by sysName.0:
clsnmp get myName.0 The output from this commands looks
similar to:1.3.6.1.2.1.1.5.0 = myhostname.austin.ibm.com 
 
- Getting the next MIB variable.
- The following requests the next logical MIB object:
clsnmp getnext udp The output from this command looks similar to: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:
clsnmp -v getnext udp The output from this command looks
similar to:udpInDatagrams.0 = 653 
 
- Setting the MIB variable.
- The following sets MIB object sysName.0 to a value of 'hostname.austin.ibm.com':
clsnmp set sysName.0  "hostname.austin.ibm.com" This command produces
output similar to:1.3.6.1.2.1.1.5.0 = hostname.austin.ibm.com 
- The value of MIB object sysName.0 can also be set using the VariableType parameter to specify the type of value being set, as in
the following example:
clsnmp set sysName.0 displayname "hostname.austin.ibm.com" This command produces output similar to:1.3.6.1.2.1.1.5.0 = hostname.austin.ibm.com 
 
- Walking the MIB tree.
The following returns by name all objects beginning
with the same object identifier prefix, but with fewer data packages to be
exchanged between the clsnmp command and the SNMP agent: clsnmp -h loopback -v -m 10 bulkwalk udp The output of this command looks similar to the following: clsnmp -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 = 5020 
- Getting multiple MIB variables.
The following requests multiple MIB
objects using the getbulk request type. The getbulk request type returns the next logical object for one or more
MIB objects listed on the command. In the following example, the -n option indicates that only one next logical object is requested for
the first two variables (sysLocation and ifTable). For all the other objects
in the list (tcp, udp, and icmp), the -m option indicates
that 5 repetitions are requested. 
 Note The getbulk request type is an SNMPv2 function. The -h parameter
identifies a host, loopback, defined in the clsnmp.conf file
as an agent that supports SNMPv2 or SNMPv3. clsnmp -h loopback -v -n 2 -m 5 getbulk sysLocation ifTable tcp udp icmp This command produces output similar to the following: sysLocation.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 = 0 
- Finding the name of an ASN.1 variable.
The following sends a request
that a search be done to obtain the textual name, for a given MIBVariable input, whose internal ASN.1 value best matches the input
ASN.1 value. The search begins with the /etc/mib.defs file
and, if not found, continues with the compiled MIB.  Only one MIBVariable is allowed per clsnmp findname invocation. For example, this can be done with a command similar
to the following: clsnmp findname 1.3.6.1.2.1.6.13.1.2 This command
produces output similar to the following: 1.3.6.1.2.1.6.13.1.2 found as: tcpConnLocalAddress A similar example is: clsnmp findname 1.3.6.1.2.1.6.13.1.2.0 This command produces output similar to the following: 1.3.6.1.2.1.6.13.1.2.0 found as: tcpConnLocalAddress.0 Another similar example is: clsnmp findname 1.3.6.1.2. This
command produces output similar to the following: 1.3.6.1.2. found as: mgmt 
- Issuing an SNMPv3 request.
- If an winSnmpName entry is configured in /etc/clsnmp.conf file on the manager host with an entry like the following (all on one
line):
target1   9.3.149.26 snmpv3 u1 -          - AuthNoPriv   HMAC-SHA
76784e5935acd6033a855df1fac42acb187aa867 -   - and on the snmpd agent
machine 9.3.149.26, user u1 is properly configured,
then we can issue command on the manager host:clsnmp -v -h target1 get sysName.0 This command will produce output similar to:sysName.0 = somehostname.austin.ibm.com 
- It is simple to issue a trap command, as follows:
clsnmp trap Note If the security model of the trap received is SNMPv3, make sure
on the manage station where is listens to the trap has the /etc/clsnmp.conf file properly configured in order to receive the trap. 
 
Files
| /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. | 
Related Information
The pwchange command, pwtokey command, snmpdv3 daemon.
The /etc/clsnmp.conf file, /etc/snmpdv3.conf file.
   
[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]