NAME

Nagios::Plugin::SNMP - Helper module to make writing SNMP-based plugins for Nagios easier.

SYNOPSIS

This module extends Nagios::Plugin and includes routines 
to do the following:

Parse and process common SNMP arguments:

* --warning|-w: Warning threshold [optional]
* --critical|-c: Warning threshold  [optional]
* --hostname|-H: SNMP device to query
* --port|-p: Port on remote device to connect to [default 161]
* --snmp-local-ip: Local IP to bind to for outgoing requests
* --snmp-version: SNMP version (1, 2c, 3)
* --snmp-timeout: Connect timeout in seconds [default 15]
* --snmp-debug: Turn on Net::SNMP debugging
* --snmp-max-msg-size N: Set maximum SNMP message size in bytes
* --rocommunity: Read-only community string for SNMP 1/v2c
* --auth-username: Auth username for SNMP v3
* --auth-password: Auth password for SNMP v3
* --auth-protocol: Auth protocol for SNMP v3 (defaults to md5)
* Connect to an SNMP device
* Perform a get() or walk() request, each method does 'the right
  thing' based on the version of SNMP selected by the user.

This module requires Net::SNMP for its' SNMP functionality; it 
subclasses Nagios::Plugin.

_snmp_validate_opts() - Validate passed in SNMP options

This method validates that any options passed to the plugin using this library make sense. Rules:

    * If SNMP is version 1 or 2c, rocommunity must be set
    * If SNMP is version 3, auth-username and auth-password must be set

connect() - Establish SNMP session

Attempts to connect to the remote system specified in the command-line
arguments; will die() with an error message if the session creation
fails.

get(@oids) - Perform an SNMP get request

Performs an SNMP get request on each passed in OID; returns results
as a hash reference where keys are the passed in OIDs and the values are
the values returned from the Net::SNMP get() calls.

walk(@baseoids) - Perform an SNMP walk request

Performs an SNMP walk on each passed in OID; uses the Net-SNMP
get_table() method for each base OID to ensure that the method will
work regardless of SNMP version in use.  Returns results as
a hash reference where keys are the passed in base OIDs and the values are
references to the results of the Net::SNMP get_table calls.

get_sys_info()

my ($descr, $object_id) = $plugin->get_sys_info();

Returns the sysDescr.0 and sysObjectId.0 OIDs from the remote
agent, the sysObjectId.0 OID is translated to an OS family; string
returned will be one of:

*  hpux
*  sunos4
*  solaris
*  osf
*  ultrix
*  hpux10
*  netbsd1
*  freebsd
*  irix
*  linux
*  bsdi
*  openbsd
*  win32
*  hpux11
*  unknown

sysDescr.0 is a free-text description containing more specific
information on the OS being queried.