notification script

Darren Hill darren at brucetelecom.com
Wed Jul 21 15:22:16 CEST 2010


Hi,

I'm having a hard time having my notification script figure out whether 
the notification is a service or host notification, and then use qpage 
to send it out.
Here's what I have so far.
I'm using opsview which does not allow seperate commands for host and 
service, so I have to write the smarts into the notification script.


#!/usr/bin/perl
use strict;
use lib '/usr/local/nagios/perl/lib';
my $contact = $ENV{NAGIOS_CONTACTNAME};
my $command = '/usr/local/bin/qpage';
my $text;
if ( $ENV{NAGIOS_SERVICEDESC} ) {
         $text = "$ENV{NAGIOS_SERVICEDESC} on $ENV{NAGIOS_HOSTNAME} is 
$ENV{NAGIOS_SERVICESTATE}: $ENV{NAGIOS_SERVICEOUTPUT}
";
}
else {
         $text = "$ENV{NAGIOS_HOSTNAME} is $ENV{NAGIOS_HOSTSTATE}: 
$ENV{NAGIOS_HOSTOUTPUT}";
}
my @command = ( $command, '-p', $contact, $text );


Any ideas?

Thanks



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list