Page 1 of 2

Nagios email notifications.

Posted: Thu Mar 19, 2015 10:03 am
by spiderpig82
Hi,

all of an sudden Nagios is not sending notification emails, nothing have change in the command.cfg or contact.cfg.
but i see now in the maillog root is receiveing emails instead?

any ideas to correct this?

Re: Nagios email notifications.

Posted: Thu Mar 19, 2015 10:10 am
by ssax
Have you tried restarting nagios?

Code: Select all

service nagios restart
If that doesn't fix it, post the output of the command below:

Code: Select all

grep enable_notifications /usr/local/nagios/etc/nagios.cfg

Re: Nagios email notifications.

Posted: Thu Mar 19, 2015 10:56 am
by spiderpig82
hi,

yes many times :)

Re: Nagios email notifications.

Posted: Thu Mar 19, 2015 10:57 am
by spiderpig82
enable_notifications=1

Re: Nagios email notifications.

Posted: Thu Mar 19, 2015 12:34 pm
by jdalrymple
What is the contents of the mails coming back to root, have you inspected them?

Is it possible a forward relay is rejecting the mails and bouncing them back to "postmaster" or "abuse" @yoursystem which just happens to forward to root?

Re: Nagios email notifications.

Posted: Mon Mar 23, 2015 9:56 am
by spiderpig82
Nagios server is permitted to relay mail, but then i'm looking into maillog then "relay=root@localhost" and "relay=localhost.localdomain [127.0.0.1]" is everywhere.
where can i correct these settings?

Re: Nagios email notifications.

Posted: Mon Mar 23, 2015 11:46 am
by tgriep
Are you using sendmail or postfix as your mailer daemon on the Nagios server?
Can you post more lines from your maillog so we can get more details?

Re: Nagios email notifications.

Posted: Mon Mar 23, 2015 11:50 am
by jdalrymple
Have you modified the notification commands? What happens when you run the following command?

Code: Select all

/usr/bin/printf "Test E-mail" | /bin/mail -s "Test Subject" [email protected]

Re: Nagios email notifications.

Posted: Mon Mar 23, 2015 5:40 pm
by spiderpig82
triep,
i'm using Sendmail, that relays thourgh our exchange mailserver.

Mar 22 04:02:30 saga sendmail[1658]: t2M428ZA001658: from=root, size=461, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Mar 22 04:02:30 saga sendmail[2548]: t2M42UxG002548: from=<[email protected]>, size=720, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Mar 22 04:02:30 saga sendmail[1658]: t2M428ZA001658: to=root, ctladdr=root (0/0), delay=00:00:22, xdelay=00:00:00, mailer=relay, pri=30461, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (t2M42UxG002548 Message accepted for delivery)
Mar 22 04:02:31 saga sendmail[2549]: t2M42UxG002548: to=<[email protected]>, ctladdr=<[email protected]> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=local, pri=30935, dsn=2.0.0, stat=Sent

But when I ran the command to test sending email, and it got through i got:
Mar 23 22:27:21 saga sendmail[4446]: t2NMRLfT004446: from=root, size=52, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Mar 23 22:27:21 saga sendmail[4448]: t2NMRLD3004448: from=<[email protected]>, size=328, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Mar 23 22:27:21 saga sendmail[4446]: t2NMRLfT004446: to=my@email, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30052, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (t2NMRLD3004448 Message accepted for delivery)
Mar 23 22:27:21 saga sendmail[4450]: STARTTLS=client, relay=myexchange., version=TLSv1/SSLv3, verify=FAIL, cipher=AES128-SHA, bits=128/128
Mar 23 22:27:22 saga sendmail[4450]: t2NMRLD3004448: to=<myemail>, ctladdr=<[email protected]> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=120328, relay=myexchange. [172.16.250.211], dsn=2.0.0, stat=Sent (<[email protected]> [InternalId=3918474] Queued mail for delivery)




jdalrymple,
i'm receiveing email when I run that command.

Re: Nagios email notifications.

Posted: Mon Mar 23, 2015 5:54 pm
by jdalrymple
Sounds weird.

First:

Code: Select all

grep NOTIF /var/log/nagios/nagios.log
If that's not the right location for your nagios.log please adjust the path as appropriate.

Then, you should see the notify command buried in the lines that come out of that grep, something like "notify-service-by-email" and/or "notify-host-by-email" - find those in your command definitions, probably /etc/nagios/objects/commands.cfg. Find that (or those) command definitions and post here. Code wraps make things much nicer to read :)