bottrap
< Prev Back to Table of Contents Next >

Configuring SNMP Session Parameters

The SNMP Session's configure subcommand is used to configure access parameters such as address, port and community strings, for the session. Each session is initialized with a number of defaults at creation time (see Creating SNMP Sessions) which can be reconfigured using this command or specified at creation. One typically creates a new session for each set of configuration parameters that need to be used simultaneously (for instance, in manging two different agents or two users of the same agent, two sessions are needed). The SDK takes care of such things as SNMPv3 Engine ID Discovery and converting passwords to localized keys as necessary.

Syntax:

% snmpcmd configure
% snmpcmd configure option value ...
% snmpcmd configure list

..where snmpcmd is the name of session to be configured and a series of option/value pairs may be present to specify configuration parameters and their desired values.

In the alternate form, the list parameter is a single argument containing a list of option/value pairs, allowing many properties to be configured from a list variable or from the output of configure with no arguments. This makes it easy to clone sessions.

Returns:

With no arguments, returns a dictionary of the session's current configuration. Otherwise, returns nothing.

Session Parameters

Option Description
-address Equivalent to -remoteaddress.
-authpass Specifies the password to be used when sending authenticated SNMPv3 messages. The SDK will automatically convert the password to a localized key internally, according to the configured Authentication Protocol, when it discovers the agent's Engine ID. If the Authentication Protocol or Engine ID change, the password will be automatically reconvered and re-localized. The value can either be an ASCII string or a colon-delimited hex string (e.g. "0x01:02:ab:cd").
-authproto Specifies the Authentication Protocol to use when sending SNMPv3 authNoPriv and authPriv messages if an Authentication Password has been set. If no password is set, the state of this parameter is ignored and all SNMPv3 messages are sent noAuthNoPriv. Accepted values are none, HMAC-SHA-96 and HMAC-MD5-96, or short forms MD5 or SHA (long form recommended).
-community Specifies both the read and write community strings to the same value. This parameter is equivalent to -readcommunity $comm -writecommunity $comm. The value can either be an ASCII string or a colon-delimited hex string (e.g. "0x01:02:ab:cd").
-db Specifies the SMI Database to use for resolution of names to OIDs, OIDs to names, types, etc. Valid values are any active SMI Database name (such as smilib1).
-localboots Sets the value of the session's own snmpEngineBoots. This property is not currently used, but is reserved for future SNMPv3 inform support.
-localengid Sets the value of the session's own snmpEngineID. This property is not currently used, but is reserved for future SNMPv3 inform support.
-localport Specifies a secondary local port to bind to for receiving notifications if and when a notification handler is registered using the bind session command.
-localtime Sets the value of the session's own snmpEngineTime. This property is not currently used, but is reserved for future SNMPv3 inform support.
-logchannel Configures channels (such as stdout, stderr or a file handle) to which hex dumps of sent and/or received packets should be output. Setting this property to an empty string disables logging. Setting it to a single channel enables logging to that channel for both sent and received packets. A two-element list can be specified to control logging for sent and received packets separately.
-port Equivalent to -remoteport.
-privpass Specifies the password to be used when sending private (encrypted) SNMPv3 messages. The SDK will automatically convert the password to a localized key internally, according to the configured Privacy Protocol, when it discovers the agent's Engine ID. If the Privacy Protocol or Engine ID change, the password will be automatically reconvered and re-localized. The value can either be an ASCII string or a colon-delimited hex string (e.g. "0x01:02:ab:cd").
-privproto Specifies the Privacy Protocol to use when sending SNMPv3 authPriv messages if a Privacy Password has been set. If no password is set, the state of this parameter is ignored and all SNMPv3 messages are sent using authNoPriv or noAuthNoPriv depending on whether or not an authentication password has been configured. Accepted values are none, CBC-DES or short form DES (long form recommended).
-readcommunity Specifies the community string to be used when sending SNMPv1 and SNMPv2c GET, GET-NEXT and GET-BULK requests. The value can either be an ASCII string or a colon-delimited hex string (e.g. "0x01:02:ab:cd").
-remoteaddress Specifies the remote IP address or host name to send requests to. If a host name is specified, the SDK will attempt to resolve the name to an IP address via DNS. An error will result if the hostname does not resolve.
-remoteport Specifies the remote port send requests to. By default, most SNMP agents accept requests on port 161, although many allow the agent to be configured to listen on a different port.
-retries Specifies the number of attempts that should be made to retransmit requests that have not been received after the first try. If non-zero, then a total of (retries + 1) attempts will be made before signalling a timeout to the script. The SDK can be configured to retry the request up to 30 times.
-straps Provided with a boolean value, can be used to enable or disable use of the straps/nmtrapd daemon. If disabled, the SDK will attempt to bind directly to port 162 rather than launching or connecting to the daemon when binding notification handlers to that port.
-timeout Specifies the timeout (in milliseconds) to wait after sending a request before considering the message to have been dropped. The total time that the SDK will wait for a response before signalling a timeout to the script is ((retries + 1) * timeout). The maximum time to wait for a response to an individual attempt is 300000 ms (5 minutes).
-username Specifies the SNMPv3 User Name to use when sending messages using the User-Based Security Model, regardless of security level. The value can either be an ASCII string or a colon-delimited hex string (e.g. "0x01:02:ab:cd").
-version Specifies the SNMP Version to use for requests. Valid values are SNMPv1, SNMPv2c, SNMPv3, or 1, 2 or 3 (the longer form is recommended).
-writecommunity Specifies the community string to be used when sending SNMPv1 and SNMPv2c SET requests. The value can either be an ASCII string or a colon-delimited hex string (e.g. "0x01:02:ab:cd").
< Prev Back to Table of Contents Next >