Translations of this page:

Involvement in Nagios

The Plugin check_snmptraps.pl

With the plugin, you can be certain traps on the DB and alarmed this. Even the issue of the message from a trap is possible.

Prerequisite:
Installation of Perl-Modul DBI

Installation:
Copy the Plugin in the libexec directory from Nagios. Now you musst set follow database parameters in the plugin:

my $dbHost = "localhost";
my $dbName = "snmptt";
my $dbUser = "root";
my $dbPass = "";
my $dbTable = "snmptt";

That's it!

The Plugin in his parameters:

   -H (--hostname)
	Hostname to query - (required)
   -S (--search)
     search a expression in the message content
   -C (--category)
	Category from SNMP-Trap (optional)
   -O (--oid)
  	OID from SNMP-Trap (optional)
   -w (--warning)
	Check for warning traps in the database
   -c (--critical)
	Check for critical traps in the database
   -u (--unknown)
	Check for unknown traps in the database
      (Default is set the option -w, -c and -u)
   -r (--read)
	Read marked traps from database too.
   -m (--message)
	Print Message from last read trap from database.
	This option can only used with -w, -c or -u!
   -t (--timeout)
     seconds before the plugin times out (default=15)
   -V (--version)
     Plugin version
   -h (--help)
     Print this help

A few examples how to call the plugin:

 ./check_snmptraps.pl -H srv_tes_02 -m -c

Output:

 CRITICAL - 1 critical Trap: This was only a test message for NagTrap|'critical trap='1;;;;

or

 ./check_snmptraps.pl -H srv_tes_02 -m -c -O '.1.3.6.1.4.1.10418.2.1.3.0.27'

Output:

 CRITICAL - 1 critical Trap: This was only a test message for NagTrap|'critical trap='1;;;;

etc.

Nagios Service Extinfo

A example for the serviceextinfo in Nagios:

define  serviceextinfo {
        host_name                       < NAGIOS HOST >
        service_description             SNMP Alerting
        notes                           SNMP Alerts
        notes_url                       http://<servername>/nagios/snmptraps/index.php?hostname=$HOSTADDRESS$
        }
 
en/doku/nagios.txt · Last modified: 2009/07/26 01:00 by mluebben     Back to top