bottrap
< Prev Back to Table of Contents Next >

Opening SNMP Sessions

The new subcommand is used to create new SNMP Sessions. Each session, including the master database, can be used to create new sessions, initialized with default configuration values or with specified values. Each session is generally associated with the combination of a single SNMP agent and access parameters.

New sessions do not automatically transmit any messages to the agent to verify that access parameters are correct. The session will be created successfully even if the access parameters are incorrect or there isn't an SNMP agent at the given address -- it is the responsibility of the script to "poll" the agent, if necessary, to verify the configuration.

Syntax:

% snmpcmd new
% snmpcmd new option value ...
% snmpcmd new list

..where snmpcmd is the name of any session (such as snmplib for the master session) and a series of option/value pairs, same as those supported by the config and cget commands, may be present to configure the session at creation time.

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:

Name of the created session, which can be later used to send SNMP requests to the configured agent or to close the session.

Session Defaults

The following defaults are assigned to newly created sessions where no value is specified at creation time:

Parameter Value
SMI Database smilib
SNMP Version SNMPv1
Remote IP Address 127.0.0.1
Remote Port 161
Local Port 162
Request Timeout 5000 (milliseconds)
Retries 3 (Total of 4 transmits/20 seconds before timeout)
Read Community public
Write Community private
SNMPv3 User Name (not set/zero-length)
SNMPv3 Auth Protocol HMAC-MD5-96
SNMPv3 Auth Password (not set - authentication disabled)
SNMPv3 Priv Protocol CBC-DES
SNMPv3 Priv Protocol (not set - privacy disabled)

Example 1 - Creating a default session:

% set sess [snmplib new]
snmplib1

Example 2 - Creating an SNMPv3 auth/priv session :

% set sess [snmplib new -version SNMPv3 -username "test user" \
    -authpass "auth password" -privpass "priv password"]
snmplib2

Example 3 - Cloning an SNMP Session

% set sess_copy [$sess new [$sess configure]]
snmplib3
< Prev Back to Table of Contents Next >