email notifications not working

jeremiah jeremiah.jester at panasonic.aero
Fri Oct 17 20:32:30 CEST 2008


Ok. I figured out the problem.

The notify_by_email command and others needed a bit more tweaking if
your using exim and not sendmail.

The command needs to be in the following format...

/usr/bin/printf "message here" | /usr/bin/exim root at localhost

Thanks!

JJ


On Fri, 2008-10-17 at 09:26 -0700, jeremiah wrote:
> Hi Patrick,
> 
> See below for answers. Puzzling.
> 
> > There are several important pieces missing here:
> >
> > 1. Does your Nagios log show that notifications are being sent? Look
> for
> > "NOTIFICATION" in your Nagios log. If it's not there, you've got a
> > configuration issue and you have not configured Nagios to notify
> when
> > that service goes critical.
> 
> Yes, i have several notifications being logged in nagios:
> 
> Service Notification[2008-10-17 15:49:16] SERVICE NOTIFICATION:
> root;(servername);LOAD-SCRIPT;CRITICAL;notify-by-email;Connection
> refused
> 
> 
> >
> > 2. Have you assigned your "admins" contact group to the service
> you're
> > not getting notifications for?
> >
> 
> Yes, "admins" is sepcified in the service:
>        
> contact_groups                  admins
> 
> > 3. Does your mail log show anything regarding the notifications, and
> > whether they were successfully or unsuccessfully relayed?
> >
> 
> Here's what I'm seeing in my mail logs (exim):
> 
> 2008-10-17 16:19:18 1Kqs2m-0000TH-3t <= <> U=Debian-exim P=local S=940
> 2008-10-17 16:19:18 1Kqs2m-0000TH-3t => nagios <servername>
> R=local_user
> T=mail_spool
> 2008-10-17 16:19:18 1Kqs2m-0000TH-3t Completed
> 
> BTW, I'm using exim not send mail so my command for sending mail looks
> like this:
> 
> define command{
>         command_name    notify-by-email
>         command_line    /usr/bin/printf "%b" "***** Nagios *****\n\n
>         Notification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC
> $\n
>         Host: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
> $SERVICESTATE
> $\n\n
>         Date/Time: $LONGDATETIME$\n\n
>         Additional Info:\n\n$SERVICEOUTPUT$" | /usr/sbin/exim "**
> $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$
> **" $CONTACTEMAIL$
>         }
> 
> 
> 
> On Thu, 2008-10-16 at 17:39 -0700, Patrick Morris wrote:
> > Hi jeremiah!
> >
> > On Fri, 17 Oct 2008, jeremiah wrote:
> >
> > > It doesn't appear that nagios v2 is sending email notifications to
> > upon
> > > error.
> > >
> > > Here is what i've checked to troubleshoot the problem and verified
> > > config files.
> > >
> > > Am I missing something??
> > >
> > > Thanks,
> > > JJ
> > >
> > > ==========
> > >
> > > !Errors do exists in the log file.
> > >
> > > ++
> > > "LOAD-SCRIPT;CRITICAL;HARD;3;Connection refused"
> > > ++
> > >
> > > !I've enabled notifications in each of my services in services.cfg
> > >
> > > ++
> > > notifications_enabled           1
> > > ++
> > >
> > > !I've set the admin email in nagios.cfg. I've also
> > > enabled_notifications=1.
> > >
> > > ++
> > > admin_email = (email hidden)
> > > ++
> > >
> > > !Verified Contacts.cfg is set...
> > >
> > > ++
> > > define contact{
> > >      contact_name      root
> > >      alias      (my name)
> > >      service_notification_period      24x7
> > >      host_notification_period      24x7
> > >      service_notification_options      w,u,c,r
> > >      host_notification_options      d,r
> > >      service_notification_commands      notify-by-email
> > >      host_notification_commands      host-notify-by-email
> > >      email     (my email)
> > >      }
> > >
> > > define contactgroup{
> > >         contactgroup_name       admins
> > >         alias                   Nagios Administrators
> > >         members                 root
> > >         }
> > > ++
> > >
> > > !Mail agent on localhost is also running.
> > >
> > > ++
> > > # telnet localhost 25
> > > Trying 127.0.0.1...
> > > Connected to localhost.
> > > Escape character is '^]'.
> > > 220 pse02.mascorp.com ESMTP Exim 4.69 Fri, 17 Oct 2008 00:13:58
> > +0000
> >
> > There are several important pieces missing here:
> >
> > 1. Does your Nagios log show that notifications are being sent? Look
> > for
> > "NOTIFICATION" in your Nagios log. If it's not there, you've got a
> > configuration issue and you have not configured Nagios to notify
> when
> > that service goes critical.
> >
> > 2. Have you assigned your "admins" contact group to the service
> you're
> > not getting notifications for?
> >
> > 3. Does your mail log show anything regarding the notifications, and
> > whether they were successfully or unsuccessfully relayed?
> >
> >
> >
> >
> >
> 
> 
> Disclaimer: The information contained in this transmission, including
> any
> attachments, may contain confidential information of Panasonic
> Avionics
> Corporation.  This transmission is intended only for the use of the
> addressee(s) listed above.  Unauthorized review, dissemination or
> other use
> of the information contained in this transmission is strictly
> prohibited.
> If you have received this transmission in error or have reason to
> believe
> you are not authorized to receive it, please notify the sender by
> return
> email and promptly delete the transmission.
> 
> 
> 
> -------------------------------------------------------------------------
> 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
> 
> 
> 

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