Nagios email notifications.

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
spiderpig82
Posts: 22
Joined: Wed Aug 27, 2014 7:29 am

Nagios email notifications.

Post 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?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios email notifications.

Post 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
spiderpig82
Posts: 22
Joined: Wed Aug 27, 2014 7:29 am

Re: Nagios email notifications.

Post by spiderpig82 »

hi,

yes many times :)
spiderpig82
Posts: 22
Joined: Wed Aug 27, 2014 7:29 am

Re: Nagios email notifications.

Post by spiderpig82 »

enable_notifications=1
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios email notifications.

Post 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?
spiderpig82
Posts: 22
Joined: Wed Aug 27, 2014 7:29 am

Re: Nagios email notifications.

Post 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?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios email notifications.

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios email notifications.

Post 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]
spiderpig82
Posts: 22
Joined: Wed Aug 27, 2014 7:29 am

Re: Nagios email notifications.

Post 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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios email notifications.

Post 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 :)
Locked