FW: Not sending e-mails

Martin Melin mmelin at gmail.com
Thu Oct 1 20:01:18 CEST 2009


Try simply copying the command_line for notify-service-by-email and running
it in a shell yourself. Or just do:
# echo "Hello world" | /bin/mail -s "Test Email" root at localhost

On Thu, Oct 1, 2009 at 8:28 PM, Scott Miller <srmiller at interbel.net> wrote:

>
> Scott Miller wrote:
> >> I know this has been hit over and over, and I've read literally
> everything I
> >> could find, but to no avail.  I have a newly install of Nagios 3.2.0 on
> a
> >> Fedora Core 8 with Postfix/Dovecot.  I have a modified script (postfix
> mail
> >> queue monitor I shared a week or so ago).  The only thing Nagios is
> doing
> on
> >> this box is looking at local services.  When I change any threshold so I
> >> will go into alarm, it does, but no e-mails get sent out.
> >>
> >> I can see in my logs the following when something comes into alarm:
> >>
> >> [1254408621] SERVICE ALERT: localhost;Postfix Mail
> >> Queue;CRITICAL;SOFT;1;CRITICAL: Postfix mailq has 14 messages queued for
> a
> >> total of 12492 Kbytes.
> >> [1254408651] SERVICE ALERT: localhost;Current Load;OK;SOFT;2;OK - load
> >> average: 4.87, 2.73, 1.43
> >> [1254408681] SERVICE ALERT: localhost;Postfix Mail
> >> Queue;CRITICAL;SOFT;2;CRITICAL: Postfix mailq has 16 messages queued for
> a
> >> total of 12497 Kbytes.
> >> [1254408741] SERVICE ALERT: localhost;Postfix Mail
> >> Queue;CRITICAL;SOFT;3;CRITICAL: Postfix mailq has 16 messages queued for
> a
> >> total of 12689 Kbytes.
> >> [1254408801] SERVICE ALERT: localhost;Postfix Mail
> >> Queue;CRITICAL;HARD;4;CRITICAL: Postfix mailq has 15 messages queued for
> a
> >> total of 12494 Kbytes.
> >> [1254408801] SERVICE NOTIFICATION: nagiosadmin2;localhost;Postfix Mail
> >> Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
> >> messages queued for a total of 12494 Kbytes.
> >> [1254408801] SERVICE NOTIFICATION: nagiosadmin;localhost;Postfix Mail
> >> Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 15
> >> messages queued for a total of 12494 Kbytes.
> >>
> >> Wondering if anyone could double check the pertinent parts of my config?
> >>
> >> Thanks in advance.
> >>
> >> Scott Miller
> >
> > What's in your mail log?  Nagios is trying to send notifications using
> > the command you've defined, according to the logs. You haven't provided
> > the definition for that command (notify-service-by-email), but I assume
> > it's trying to send an email.
> >
> > If you're using anything like the example commands that come with
> > Nagios, it is probably using something like "/bin/mail" to send the
> > message, and your mail log would be a good place to look for why it's
> > not being delivered.
>
> Sorry - didn't include that from the commands.cfg - Here's what I have.
>
> commands.cfg
> ============
> # 'notify-host-by-email' command definition
> define command{
>        command_name    notify-host-by-email
>        command_line    /usr/bin/printf "%b" "***** Nagios
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
> $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
> $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert:
> $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
>        }
>
> # 'notify-service-by-email' command definition
> define command{
>        command_name    notify-service-by-email
>        command_line    /usr/bin/printf "%b" "***** Nagios
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
> $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional
> Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service
> Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
>        }
>
> This is the exact same way I have it on another machine running checks for
> multiple boxes and devices.  The only difference, is this server is running
> Postfix, the other (working) is running Sendmail.
>
> In my logs:
> /var/log/maillog - grep for nagios - there's nothing
> /var/log/messages shows
> Oct  1 10:53:20 mail4 nagios: SERVICE NOTIFICATION:
> nagiosadmin2;localhost;Postfix Mail
> Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 13
> messages queued for a total of 3326 Kbytes.
> Oct  1 10:53:20 mail4 nagios: SERVICE NOTIFICATION:
> nagiosadmin;localhost;Postfix Mail
> Queue;CRITICAL;notify-service-by-email;CRITICAL: Postfix mailq has 13
> messages queued for a total of 3326 Kbytes.
>
> Looks like it's trying - maybe something in Postfix stoping it?  I'll have
> to do a bit more digging and testing.
>
> Scott Miller
>
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20091001/b88f4534/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
-------------- next part --------------
_______________________________________________
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