Help - I am unable to send notifications

Andreas Ericsson ae at op5.se
Thu Jul 24 15:04:48 CEST 2008


jonathan williams wrote:
> 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
> 

Ahh, progress.

> However no email is being delivered.  I know I can successfully send
> SMTP mail from this box because I tested it via telnet 25.

That's not a very good indication though.

>  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

What's in /var/log/mail.log? If you don't find anything
regarding send_mail.pl, you might want to alter the
path to the logfile, since the nagios user normally
doesn't have permissions to write files in /var/log.

> 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$"

I'll just assume you're using this command properly, but
you might want to double-check that properly.

> 
> 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.  
> 

Read the logfiles and see if send_mail.pl complains.
If it does and you can't make sense of it, pay someone
to help you. The time you'll save on it will be well
worth the money you spend, I think.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
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