Page 1 of 2

Nagios email notifications not working

Posted: Tue Oct 18, 2016 2:01 am
by kellyangell
nagios.cfg
(43.96 KiB) Downloaded 329 times
contacts.cfg
(551 Bytes) Downloaded 288 times
commands.cfg
(8.05 KiB) Downloaded 274 times
Hello

My email alerts are not working, can someone please check my configuration files, i have uploaded them. i have sent a test message from nagios so i know send mail is working, but i am not receiving notifications for critical and warnings. please can someone help me out :)

Cant wait to hear from you .

Re: Nagios email notifications not working

Posted: Tue Oct 18, 2016 10:25 am
by rkennedy
Could you please post your /usr/local/nagios/var/objects.cache file for us to look at? The ones you posted look fine, assuming general-contact has notification commands defined.

Also, please let us know the host / service and contact, that you're attempting to get notifications for so that we know what to compare it against.

Re: Nagios email notifications not working

Posted: Wed Oct 19, 2016 2:55 am
by kellyangell
Hello

i have got it working , so need need to do anything, one more thing is the mails i am receiving are blank and i would like it to contain the status information , is there something i need to change in these 2 entries , as it is a db query i am running i would like to see the output and comments in my email alerts.

hope to hear from you soon. kelly


# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/mail "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/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/mail "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\n Additional Info:\n\n$SERVICEOUTPUT$\n$LONGSERVICEOUTPUT$ $NOTIFICATIONCOMMENT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

Re: Nagios email notifications not working

Posted: Wed Oct 19, 2016 12:44 pm
by avandemore
Here is some documentation for you: Standard Macros in Nagios

So your command definitions are correct. Is your host/service returning output? Can you post an example message?

Re: Nagios email notifications not working

Posted: Wed Oct 19, 2016 12:46 pm
by rkennedy
Take a look at this - https://assets.nagios.com/downloads/nag ... olist.html

You could change your $HOSTOUTPUT$ to $LONGHOSTOUTPUT$ but, I'm not sure that will be the data you're after. For your services, you've already got $LONGSERVICEOUTPUT$ appended so I don't believe more information will be possible.

Could you show us what you're seeing in a current email, vs what you would like to see with screenshots?

Re: Nagios email notifications not working

Posted: Wed Oct 26, 2016 1:45 am
by kellyangell
hello

here is a screen shot of the email , there is no information its just the subject

thanks

Re: Nagios email notifications not working

Posted: Wed Oct 26, 2016 9:48 am
by avandemore
Can you do the following:
  1. backup /usr/local/nagios/etc/nagios.cfg
  2. edit /usr/local/nagios/etc/nagios.cfg to contain the values debug_level=256 and debug_verbosity=2, replacing the existing ones
  3. Restart Nagios Core
  4. Provoke an event which will trigger one of these emails
  5. Upload /usr/local/nagios/var/nagios.debug
  6. Wait for further instructions, if that is enough information I'll have you restore the original and restart again.

Re: Nagios email notifications not working

Posted: Fri Nov 04, 2016 2:54 am
by kellyangell
it won't allow me to upload a file with the .debug extension

Re: Nagios email notifications not working

Posted: Fri Nov 04, 2016 9:59 am
by tmcdonald
Simply change the extension to .txt and it should be fine.

Re: Nagios email notifications not working

Posted: Fri Nov 04, 2016 10:20 am
by kellyangell
haha of course . its been a long day ! here is the file