Help - I am unable to send notifications
jonathan williams
jonathan.williams at us.g4s.com
Wed Jul 23 19:25:43 CEST 2008
On Wed, 2008-07-23 at 05:03 -0700, Andreas Ericsson wrote:
> jonathan williams wrote:
> > [1216749581] Warning: Attempting to execute the command
> > "/usr/local/nagios/libexec/send_mail.pl -n "SERVICE RECOVERY" -h
> > "jwilliamspc" -s "OK" -a "10.10.113.51" -i "PrintSpooler - Spooler:
> > Started - check_nt!SERVICESTATE!-d SHOWALL -l Spooler" -d "Tue Jul
> 22
> > 10:59:41 PDT 2008" -e "jonathan.williams at us.g4s.com"" resulted in a
> > return code of 126. Make sure the script or binary you are trying
> to
> > execute actually exists..."
> >
>
> Due to some weird and slightly bent way of passing errors between
> processes, return code 126 means "Operation not permitted". In
> english, that means the script is not executable, or one of the
> directories leading up to it isn't readable by the Nagios user.
>
> Run this command (as root):
>
> chmod 0755 /usr/local/nagios/libexec/send_mail.pl
>
> (correct the path if necessary)
> and things just might start working a little better.
>
> --
> Andreas Ericsson andreas.ericsson at op5.se
> OP5 AB www.op5.se
> Tel: +46 8-230225 Fax: +46 8-230231
>
> Looks like Nagios is successfully calling send_mail.pl since I get
> this in the nagios.log:
[1216833337] SERVICE NOTIFICATION:
nagiosadmin;jwilliamspc;PrintSpooler;CRITICAL;service-notify-by-email;Spooler: Stopped
However no email is being delivered. I know I can successfully send
SMTP mail from this box because I tested it via telnet 25. Here is what
I have configured in the send_mail.pl file:
#!/usr/bin/perl -w
# than a bunch of commented stuff on how to set up the command.cfg file
use strict;
use Net::SMTP;
use Getopt::Std;
my $mailhost = 192.168.1.9 ;
my $maildomain = us.g4s.com ;
my $mailfrom = nagios at us.g4s.com;
my $mailto = jonathan.williams at us.g4s.com;
my $timeout = 30;
my $mailsubject = ''; # Leave blank
my $mailbody = ''; # Leave blank
my $logfile = '/var/log/mail.log; # Put somewhere better
my $debug = 1; # To enable SMTP session debugging to logfile
This is the commangs.cfg file:
define command{
command_name service-notify-by-email
command_line $USER1$/send_mail.pl -n "SERVICE $NOTIFICATIONTYPE$" -h
"$HOSTNAME$" -s "$SERVICESTATE$" -a "$HOSTADDRESS$" -i "$SERVICEDESC$ -
$SERVICEOUTPUT$ - $SERVICECHECKCOMMAND$" -d "$LONGDATETIME$" -e
"$CONTACTEMAIL$"
}
Also the contacts.cfg
define contact{
contact_name nagiosadmin ; Short name of
user
use generic-contact ; Inherit default values from generic-contact
template (defined above)
alias nagiosadmin ; Full name of user
host_notification_commands host-notify-by-email
service_notification_commands service-notify-by-email
email jonathan.williams at us.g4s.com ;
<<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
efine contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}
These are all the variables I can think of. Something must still be
amiss or the perl is not working or something? I am not sure.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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