[Nagios-users] Problems with email alerts

Andreas Ericsson ae at op5.se
Wed Oct 26 19:56:59 CEST 2005


Christian Lahti wrote:
> Hello List.
> 
>  
> 
> I am wondering if I should submit this problem to the devel list?

Most likely. I'm doing that now though, so just reply in the normal manner.

> 
> Ok, I am beating my head against a problem, need a Nagios guru.  We have
> a redhat box with Nagios installed, here is the package list:
>  
> nagios-devel-1.2-2.2.el4.rf
> nagios-nsca-2.4-2.2.el4.rf
> nagios-1.2-2.2.el4.rf
> nagios-nrpe-2.0-3.2.el4.rf
> nagios-plugins-nrpe-2.0-3.2.el4.rf
> nagios-plugins-1.4.1-1.2.el4.rf
>  
> I have setup Nagios many times, and this installation was working
> perfectly up until a week or so ago.  Suddenly the notify-by-email and
> host-notify-by-email stop sending email.  checks are working fine, just
> no notifications.


Has something else been upgraded/downgraded/replaced/removed on the 
system? glibc, the kernel, the shell (/bin/sh, not necessarily 
/bin/bash) are the most important, but anything you can remember, really.


>  to test this I force a failure, and the
> /var/log/messages has:
>  
> Oct 23 21:35:56 envy nagios: SERVICE ALERT:
> envy;TEST;CRITICAL;HARD;3;Connection to 10.250.100.230 failed
> Oct 23 21:35:56 envy nagios: SERVICE NOTIFICATION:
> chris.gmail;envy;TEST;CRITICAL;notify-by-email;Connection to
> 10.250.100.230 failed
>  
> This implies that the notification fired...so I create a test service to
> use a new notifier called notify-by-test with this as the command:
>  
> # 'notify-by-test' command definition
> define command{
>         command_name    notify-by-test
>         command_line    /usr/bin/printf "TEST FOR NAGIOS" | /bin/mail -s
> "** test alert **" clahti at gmail.com
> }
>  
> This command_line works from the normal command line as the nagios user
> when run in a shell.  Now I force an OK and this is what the log says:
>  

Does it work if you do

/bin/sh -c /usr/bin/printf "TEST FOR NAGIOS" | /bin/mail -s "test" 
clahti at gmail.com

and

exec /bin/sh -c /usr/bin/printf "TEST FOR NAGIOS" | /bin/mail -s "test" 
clahti at gmail.com

?

> Oct 23 21:49:47 envy nagios: SERVICE ALERT: envy;TEST;OK;HARD;3;test2
> Oct 23 21:49:47 envy nagios: SERVICE NOTIFICATION:
> chris.gmail;envy;TEST;OK;notify-by-test;test2
>  
> Implies that the notification went out, but I still get no mail.
> Finally I change the command to:
>  
> command_line    touch /tmp/THISFIRED
>  
> Repeat the above and the log shows service notification, but the
> THISFIRED file does not appear, which leads me to believe Nagios is not
> running the command...please tell me this is something simple and I am
> being dense, I am at my wits end (I thought I was pretty good with
> Nagios...)
>  

Seeing as this is the first bug-report with this particular problem I'd 
say you're either doing something wrong or your system is acting up for 
some reason.

Try running this command while forcing the touch /tmp/THISFIRED 
notification.

	strace nagios /etc/nagios/nagios.cfg 2>&1 | tee nagios-trace

And then

	grep execve nagios-trace | grep touch

If you can't find it Nagios isn't running the command. If you find it 
but it returns -1 the kernel has decided to go against you.

-- 
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 JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information




More information about the Developers mailing list