[SOLVED] Re: nagios not sending mail (nagios -> postfix connection problem?)

Jim Nachlin jim.nachlin at gawker.com
Mon Sep 26 23:29:05 CEST 2011


Patrick,

You were correct!

I have overwritten my original command, but the essence of the
solution was to run the command_line of the notify-by-email command.
This immediately showed me that there was no "/usr/bin/mail" on my
server.

So here is the command that works:

define command{
        command_name    notify-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$
        }


If anyone reading this is having a problem with Nagios not sending
mail, and there's nothing wrong with your MTA or email account, then
check that the command you are piping to actually works!

Simplifying the above command_line:

$ echo "this is the body of a test message"  | /bin/mail -s "this is a
subject" your_email at example.com

-Jim

On Thu, Sep 22, 2011 at 8:57 PM, Morris, Patrick <patrick.morris at hp.com> wrote:
> -----Original Message-----
> From: Jim Nachlin [mailto:jim.nachlin at gawker.com]
> Sent: Wednesday, September 21, 2011 9:58 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] nagios not sending mail (nagios -> postfix
> connection problem?)
>
>> Hi All,
>
>> Very common problem, I know, but I can't figure it out.
>
>> Nagios is not sending email alerts for outages.  It had worked before,
>> and then stopped.  I suspect a permissions or file ownership issue, as
>> I think I fixed this problem once before by chowning most of
>> /etc/nagios/ to nagios:nagios.
>
>> I see alerts in nagios.log:
>
>> [1316623404] SERVICE NOTIFICATION:
>> james;gm72;DISK_VAR;CRITICAL;notify-by-email;CHECK_NRPE: Socket
>> timeout after 10 seconds.
>
>> I see nothing in /var/log/maillog.
>
> All the config information you included is a great start.  However...  you
> didn't include the definition of "notify-by-email," which would tell us the
> command used to send mail (which is the part that isn't working, so it's
> pretty important).
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> 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
>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
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