How to test a Nagios email
This is an odd question, but I can't figure out why my nagios emails aren't being sent. In fact, I got my last one three days ago so it *should* be working.
I have everything in contacts.cfg, and the admin page tells me that the following should be sent: Unknown, Warning, Critical, Recovery, Flapping, Downtime I also have notify-service-by-email and notify-host-by-email. I have no idea if nagios emails just don't want to be sent or what -- and I'm not even sure if the nagios emails are even trying to be sent. Here's my contacts.cfg: Code:
define contact{ Meanwhile, I have some downtime on a service and didn't get notified. Only the web interface is helping me out here. Any ideas why I am not getting email? How can I run a test to see if everything's working okay? |
What distro your using on your nagios server? You need to have email client service for your nagios server in order to receive email from your nagios server. Nagios email under yahoo mail will fall on Spam folder.
|
- Add the following options to contact section:
Code:
service_notifications_enabled 1 - Open up 2 terminals (I like Terminator): one to tail the /usr/local/nagios/var/nagios.log and one to /var/log/maillog to see what happen. |
Quote:
As I mentioned, I got email a day prior so I don't understand why that would happen. I am not using Yahoo and there's nothing in my spam folder (I check that pretty often). |
Quote:
Thanks. I'm reviewing it now. The only thing I see is this, but it happens every 5 minutes at the same exact second so it doesn't look like anything is happening: Code:
Sep 25 23:57:58 server sendmail[24024]: o8Q3vw5i024024: server.domain.host.com [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA Code:
[1285473600] CURRENT SERVICE STATE: hostname;HTTP;CRITICAL;HARD;4;Connection refused Here's the Nagios contact descriptor: Code:
define contact{ Any ideas? |
Quote:
Quote:
|
Quote:
Yup - nothing is being sent or logged. And I can send mail from the command line and via [al]pine which is what I normally use. I just tested it. I have no idea where my nagios emails went but they're missing. :( |
try giving the server own email address, cos I installed it on my server and it is working fine & great.
Say if your domain hosted is: demo.com then use the email address : user@demo.com and you will be able to get emails from Nagios. Plz check if this works.If not, plz also check if you have any email server installed on your server on port 25. |
Quote:
|
More interesting stuff.
I ran this on the command line: Code:
# /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$ **" myemailaddress@gmail.com It's only through Nagios that it's not running. There's nothing in the nagios logs either to reflect that it is trying to notify me. The last time I got anything was just a few days ago (Sept 22) where it showed this. Code:
[1285033873] SERVICE NOTIFICATION: nagiosadmin;localhost;Current Users;OK;notify-service-by-email;USERS OK - 2 users currently logged in Code:
[1285516837] SERVICE ALERT: localhost;vsftpd;CRITICAL;HARD;4;Connection refused I figure something's up with my configuration files, but I never changed anything.. I'll go back to the drawing board and try to figure this out. |
hmm, okay, I changed some files and tweaked some items, and I noticed in many cases I wasn't waiting long enough (apparently nagios doesn't send notifications until the third check). I mostly added notificatons_enabled (1) to all of the items that I was most concerned about and it seems to be working now. Thanks for the help ;)
|
All times are GMT -5. The time now is 07:16 AM. |