SNMP commands

To send SNMP GET, GETNEXT and SET operations to an SAA, use a sequence of commands, either snmpget, snmpgetnext, or snmpset, to build the PDU, then use an snmpsync command to send the PDU.

To specify a MIB object in a command, identify it either by name, using the format name.?, or by OID, using the format oid.?.

snmpstart

The snmpstart command initiates an SNMP session for configuring a probe. It has the following format:

snmpstart version host community port retries

Table 1 describes each parameter in this command, and indicates the monitor element from which you can access the values defined in a profile element.

Table 1. Snmpstart command parameters 

Parameter

Type

Description

Access Using Element

version

1
2
3

Selects the SNMP version used in the session:

1 - SNMP version 1

2 - SNMP version 2c

3 - SNMP version 3

$version

host

string

The DNS name or IP address of the host on which the target SAA is running. The monitor sends all SNMP commands to this host.

$sourceHostName

community

string

The SNMP community used to configure the probe. This community must have write privileges for the Response Time Monitor MIB.

$community

port

integer

The port number on which the target SAA is listening. The monitor sends all SNMP commands to this port.

$portNum

retries

integer

The number or attempts to resend SNMP PDUs to the target SAA if the initial attempt is unsuccessful.

$snmpRetries

snmpget

The snmpget command retrieves the value of a MIB object. It adds an OID to the current SNMP GET PDU, or if a PDU does not already exist, it creates one. Once you have constructed the GET PDU using one or more snmpget commands, send it using the snmpsync command.

The snmpget command has the format:

snmpget oid element

Table 2 describes each parameter in this command.

Table 2. Snmpget command parameters 

Parameter

Type

Description

oid

string

The OID or name of the MIB object to be retrieved.

element

string

The name of the element in which the retrieved value is stored.

snmpgetnext

The snmpgetnext command retrieves the value of the next MIB object in a sequence or table. It adds an OID to the current SNMP GETNEXT PDU, or if a PDU does not already exists, it creates one. Once you have constructed a GETNEXT PDU using one or more snmpgetnext commands, send it using the snmpsync command.

The snmpgetnext command has the format:

snmpgetnext oid element

Table 3 describes each parameter in this command.

Table 3. Snmpgetnext command parameters 

Parameter

Type

Description

oid

string

The OID or name of the MIB object to be retrieved.

element

string

The name of the element in which the retrieved value is stored.

snmpset

The snmpset command sets the value of a MIB object. It adds an OID to the current SNMP SET PDU, or if a PDU does not already exist, it creates one. Once you have constructed a SET PDU using one or more snmpset commands, send it using the snmpsync command.

The snmpset command has the format:

snmpset oid format value

Table 4 describes each parameter in this command.

Table 4. Snmpset command parameters 

Parameter

Type

Description

oid

string

The OID or name of the MIB object to be written.

format

string

The format of the value:

i - Integer

s - Display string

x - Hexadecimal address

u - Unsigned integer

t - Timeticks

a - IP address

o - Object ID

d - Decimal string

b - Bits

value

string

The value written to the MIB object.

snmpsync

The snmpsync command sends any existing GET, GETNEXT, and SET PDUs. It has the format:

snmpsync

If PDU transmission fails, script execution terminates, and the monitor writes error information to the $message element.

snmptrysync

The snmptrysync command is identical to the snmpsync command, however it does not terminate script execution if the command fails.

snmpwait

The snmpwait command pauses execution of a script until a specified MIB object reaches a specific value or a timeout period expires. During a wait, the monitor polls the specified MIB object once per second. The wait terminates when either the object's value equals the target value or the timeout period expires, whichever occurs first. Typically, you use this command to wait for the completion of a probe test.

The snmpwait command has the format:

snmpwait oid value timeout

Table 5 describes each parameter in this command.

Table 5. Snmpwait command parameters 

Parameter

Type

Description

oid

string

The OID or name of the MIB object for whose value the command waits.

value

string

The target value. When the MIB object contains this value, the wait ends.

timeout

string

Sets the maximum length of the wait (in seconds). The wait ends if the period reaches this time, regardless of whether the MIB object contains the target value.

snmpend

The snmpend command terminates the SNMP session. Use it at the end of a probe script. The command has the format:

snmpend