The routines for performing SNMP operations correspond to the standard SNMP Version 1 operations and have the following parameters in common:
The community string. If no community string is specified, public is used.
The hostname or IP address of the device you want to query.
port number to which to send the query or trap. The default for all
snmptrap() is 161. The default for
snmptrap() is 162.
The timeout in seconds; if no response is received within this period, the operation is considered to have failed and is retried. The default is 2 seconds.
The number of retries before the routine returns failure. The default is 5.
The backoff value; for each successive retry, the new timeout period is obtained by multiplying the current timeout with the backoff. The default is 1.
The object ID or textual name of the object you are querying.
The syntax of the
snmpget() routine is:
community@host:port:timeout:retries:backoff, OID, [OID...])
snmpget() fails, it returns
Recall that all the MIB-II objects are preloaded into this Perl module, so the following code is legal:
@sysDescr = snmpget("public\@cisco.ora.com", "sysDescr");
We did not specify any of the optional parameters
(timeout, backoff, etc.);
the default values will be used. This routine lets us request
"sysDescr" as shorthand for
sysDescr.0. When ...