[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nagios-users
Subject:    [Nagios-users] notification script
From:       Darren Hill <darren () brucetelecom ! com>
Date:       2010-07-21 13:22:16
Message-ID: 4C46F488.5000000 () brucetelecom ! com
[Download RAW message or body]

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@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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic