cl_snmp command

Purpose

Issues Simple Network Management Protocol (SNMP) requests to agents and processes SNMP responses returned by agents.

Syntax

cl_snmp [-com][-debug Level] [-host TargetHost] [-timeout TimeoutValue] [-retry RetryNumber] [-max MaxRepetitions] [-file ConfigurationFile] [-port PortNumber] [-verbose ] [-non NonRepeaters] Function [MIBvariable][VariableType][Value][...]]

Description

Use the cl_snmp command to issue SNMP requests to agents and to process SNMP responses returned by agents. The Virtual I/O Server cl_snmp command can be used for SNMPv1, SNMPv2c, and SNMPv3 requests.

Flags

Flag name Description
-com 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.
-debug Level Specifies a debugging level during run time. The default is 0. The higher the debugging level, the greater the number of messages that are displayed. The levels can be from 0 through 4.
-host 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 the local host.
-timeout TimeoutValue Specifies the amount of time (in seconds) that the cl_snmp command waits for a reply from the SNMP agent. The default is 3.
-retry RetryNumber Specifies the maximum number of times to retry the command if it timed out. The default is 2.
-max MaxRepetitions Specifies the number of lexicographic successors to be returned for each variable binding pair after the first -non number successors. The parameter applies only to the getbulk request. This is ignored if the function request is not a getbulk request. For example, starting with successor -non number+1, return -max number of successors for each variable binding pair. The default is 10.
-file ConfigurationFile Specifies the full path and file name of the configuration file.
-port PortNumber Specifies the number of the port that listens for traps. If a port number is not specified, the cl_snmp trap function listens on the well-known port 162, which is the default port for cl_snmp traps.
-verbose 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.
-non NonRepeaters Specifies the number of variable binding pairs (name/value), starting with the first, for which only a single successor is returned. This parameter applies only to getbulk requests. This is ignored if the function request is not a getbulk request. The default is 0.
Function [MIBvariable] [VariableType] [Value] [...]] Specifies the SNMP function or 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 the walk function, this is the MIB object prefix. A prefix can be any leading portion of the complete object identifier. When used with the findname command, this object identifier is in the ASN.1 notation.
Value
Specifies the value to be set by the SET function. If white space is needed in the value, enclose the value in quotation marks. 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, cl_snmp command 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:
  • bitstring
  • counter
  • counter32
  • counter64
  • display or displaystring
  • gauge
  • gauge32
  • integer
  • integer32
  • ipaddress
  • nsapaddress
  • null
  • objectidentifier or OID
  • octetstring
  • opaque
  • opaqueascii
  • timeticks
  • uinteger

Request Types

Request Type name Description
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, it continues with the compiled management information base (MIB). Only one MIBVariable is allowed per cl_snmp findname invocation.
get Sends a request to an SNMP agent for a specific MIB variable. The cl_snmp command then waits for a response or times out.
getbulk Obtains the value of the variables in the MIB tree specified by the object identifier (OID) or MIB variable name. A single getbulk performs the same function as a series of getnext commands, with fewer data exchanges between the cl_snmp command and the SNMP agent.
getnext Sends a request to an SNMP agent for the next MIB variable that lexicographically follows the MIBVariable specified. The cl_snmp command then waits for a response or times out.
set Sends a request to an SNMP agent to set a specific MIBVariable. The cl_snmp command 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 -port option. The cl_snmp 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.

Examples

To issue an SNMP request, run the following command:
cl_snmp -host hostname get sysName.0



Last updated: Wed, November 18, 2020