Nagios email notifications not working
-
- Posts: 18
- Joined: Mon Aug 08, 2016 3:20 am
Nagios email notifications not working
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
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.
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.
Former Nagios Employee
-
- Posts: 18
- Joined: Mon Aug 08, 2016 3:20 am
Re: Nagios email notifications not working
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$
}
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$
}
-
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Nagios email notifications not working
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?
So your command definitions are correct. Is your host/service returning output? Can you post an example message?
Previous Nagios employee
Re: Nagios email notifications not working
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?
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?
Former Nagios Employee
-
- Posts: 18
- Joined: Mon Aug 08, 2016 3:20 am
Re: Nagios email notifications not working
hello
here is a screen shot of the email , there is no information its just the subject
thanks
here is a screen shot of the email , there is no information its just the subject
thanks
- Attachments
-
- email .tiff (75.92 KiB) Viewed 3913 times
-
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Nagios email notifications not working
Can you do the following:
- backup /usr/local/nagios/etc/nagios.cfg
- edit /usr/local/nagios/etc/nagios.cfg to contain the values debug_level=256 and debug_verbosity=2, replacing the existing ones
- Restart Nagios Core
- Provoke an event which will trigger one of these emails
- Upload /usr/local/nagios/var/nagios.debug
- Wait for further instructions, if that is enough information I'll have you restore the original and restart again.
Previous Nagios employee
-
- Posts: 18
- Joined: Mon Aug 08, 2016 3:20 am
Re: Nagios email notifications not working
it won't allow me to upload a file with the .debug extension
Re: Nagios email notifications not working
Simply change the extension to .txt and it should be fine.
Former Nagios employee
-
- Posts: 18
- Joined: Mon Aug 08, 2016 3:20 am
Re: Nagios email notifications not working
haha of course . its been a long day ! here is the file
- Attachments
-
- nagios.rtf
- (732.26 KiB) Downloaded 212 times