healthfoundation
asked on
Nagios Email Notifications! HELP!
Hi,
I am running Nagios Core with VShell on Ubuntu 10.10. I have worked my way through the PostFix installation guide found here: https://help.ubuntu.com/community/Postfix and my contact.cfg file is setup with a email address that is hosted on our MS Exchange server. Am I missing something here because I am not receiving any notifications even when I try and force one through from Nagios.
I am a newbie when it comes to Linux so needs some step by step help is required. Your help will be greatly appreciated as this is the last thing I need to get working on my Nagios implementation.
Looking in the log I see this: (email address & have been changed for privacy)
Warning: Attempting to execute the command "/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: C:\ Drive Space\nHost: BES/WHD Server\nAddress: xxx.xxx.xx.xx\nState: WARNING\n\nDate/Time: Fri Nov 12 10:02:56 GMT 2010\n\nAdditional Info:\n\nc:\ - total: 33.88 Gb - used: 28.64 Gb (85%) - free 5.24 Gb (15%)\n" | /bin/mail -s "** PROBLEM Service Alert: BES/WHD Server/C:\ Drive Space is WARNING **" ict@health.org.uk" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[12-11-2010 10:02:56] SERVICE NOTIFICATION: nagiosadmin;THFARES;C:\ Drive Space;WARNING;notify-servi ce-by-emai l;c:\ - total: 33.88 Gb - used: 28.64 Gb (85%) - free 5.24 Gb (15%)
Any help would be greatly appreciated!!! Lots of points up for grabs!
Thanks!
I am running Nagios Core with VShell on Ubuntu 10.10. I have worked my way through the PostFix installation guide found here: https://help.ubuntu.com/community/Postfix and my contact.cfg file is setup with a email address that is hosted on our MS Exchange server. Am I missing something here because I am not receiving any notifications even when I try and force one through from Nagios.
I am a newbie when it comes to Linux so needs some step by step help is required. Your help will be greatly appreciated as this is the last thing I need to get working on my Nagios implementation.
Looking in the log I see this: (email address & have been changed for privacy)
Warning: Attempting to execute the command "/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: C:\ Drive Space\nHost: BES/WHD Server\nAddress: xxx.xxx.xx.xx\nState: WARNING\n\nDate/Time: Fri Nov 12 10:02:56 GMT 2010\n\nAdditional Info:\n\nc:\ - total: 33.88 Gb - used: 28.64 Gb (85%) - free 5.24 Gb (15%)\n" | /bin/mail -s "** PROBLEM Service Alert: BES/WHD Server/C:\ Drive Space is WARNING **" ict@health.org.uk" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
[12-11-2010 10:02:56] SERVICE NOTIFICATION: nagiosadmin;THFARES;C:\ Drive Space;WARNING;notify-servi
Any help would be greatly appreciated!!! Lots of points up for grabs!
Thanks!
ASKER
I have now changed the /bin/mail to /usr/bin/mail.
I get don't seem to get any error in the nagios log now but emails still aren't coming through, any suggestions?
This is what I see in Nagios logs:
[12-11-2010 13:09:59] SERVICE NOTIFICATION: nagiosadmin;SERVERNAME;C:\ Drive Space;CRITICAL;notify-serv ice-by-ema il;c:\ - total: 33.88 Gb - used: 30.77 Gb (91%) - free 3.11 Gb (9%)
I get don't seem to get any error in the nagios log now but emails still aren't coming through, any suggestions?
This is what I see in Nagios logs:
[12-11-2010 13:09:59] SERVICE NOTIFICATION: nagiosadmin;SERVERNAME;C:\
Does mail work from command line?
Does the user nagiosadmin exist, can he receive emails sent from command line?
Does the user nagiosadmin exist, can he receive emails sent from command line?
ASKER
How do i send an email from the command line?
# mail -s “Hello world” you@youremailid.com
some more help in the below link:
http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/
-> Check the contact definition for nagiosadmin user make sure he has valid email id
-> make sure your email (or) relay server is configured correctly
-> make sure your mail server service is up and running.
some more help in the below link:
http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/
-> Check the contact definition for nagiosadmin user make sure he has valid email id
-> make sure your email (or) relay server is configured correctly
-> make sure your mail server service is up and running.
instead of using the command 'mail' to send messages, try using 'mailx' instead
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
I don't think mailx comes a default package!
it can be installed ... and i know it works for me :)
ASKER
kosarajudeepak I tried your email and I didnt get any errors back in the command line, and I didnt get an email into my inbox...?
Ways I can trouble should this anyone?
Ways I can trouble should this anyone?
ASKER
sangamc can you provide any help troubleshooting this?
ASKER
When sending the email I notice the mail service/executable pops up in the resource list and then disappears... Not sure if thats right or wrong? Could it be our exchange?
a couple of things you can do. the first is open a new console window on the nagios server and navigate to the logs directory. this is usually /var/logs/. find the maillog file and use this command to start monitoring it
tail -f /var/log/maillog
then in another console window you are going to run the mail command to see if it actually sends mail out or generates error messages in the maillog.
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: TEST\nHost: TEST \nState: TEST\nAddress: TEST\nInfo: TEST\n\nDate/Time: TEST\n" | mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" sanga.collins@gmail.com
when i run this command, this is what i get in my gmail
From: root
to: me
show details 9:34 AM (8 minutes ago)
***** Nagios *****
Notification Type: TEST
Host: TEST
State: TEST
Address: TEST
Info: TEST
Date/Time: TEST
and in my maillog this is what i get.
Nov 12 09:34:35 cs sendmail[6325]: oACEYYfm006325: from=<root@cs.mgt06m.itm>, size=467, class=0, nrcpts=1, msgid=<201011121434.oACEYY io006324@c s.mgt06m.i tm>, proto=ESMTP, daemon=MTA, relay=cs.mgt06m.itm [127.0.0.1]
Nov 12 09:34:35 cs sendmail[6324]: oACEYYio006324: to=sanga.collins@gmail.com , ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30188, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (oACEYYfm006325 Message accepted for delivery)
Nov 12 09:34:36 cs sendmail[6327]: oACEYYfm006325: to=<sanga.collins@gmail.co m>, ctladdr=<root@cs.mgt06m.it m> (0/0), delay=00:00:02, xdelay=00:00:01, mailer=esmtp, pri=120467, relay=gmail-smtp-in.l.goog le.com. [74.125.45.27], dsn=2.0.0, stat=Sent (OK 1289572976 h28si8008615yha.0)
tail -f /var/log/maillog
then in another console window you are going to run the mail command to see if it actually sends mail out or generates error messages in the maillog.
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: TEST\nHost: TEST \nState: TEST\nAddress: TEST\nInfo: TEST\n\nDate/Time: TEST\n" | mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" sanga.collins@gmail.com
when i run this command, this is what i get in my gmail
From: root
to: me
show details 9:34 AM (8 minutes ago)
***** Nagios *****
Notification Type: TEST
Host: TEST
State: TEST
Address: TEST
Info: TEST
Date/Time: TEST
and in my maillog this is what i get.
Nov 12 09:34:35 cs sendmail[6325]: oACEYYfm006325: from=<root@cs.mgt06m.itm>,
Nov 12 09:34:35 cs sendmail[6324]: oACEYYio006324: to=sanga.collins@gmail.com
Nov 12 09:34:36 cs sendmail[6327]: oACEYYfm006325: to=<sanga.collins@gmail.co
ASKER
Right I've looked at my log and this is basically what I am getting:
root@THF0091:/var/log# tail -f /var/log/mail.log Nov 12 14:49:19 THF0091 postfix/smtp[5388]: 51A9B81C9F: to=<aname@hotmail.co.uk>, relay=none, delay=332, delays=332/0.03/0/0, dsn=4.4.1, status=deferred (connect to mx2.hotmail.com[65.54.188. 94]:25: Connection refused)
Nov 12 14:49:19 THF0091 postfix/smtp[5386]: 5977881B6E: to=<aname@health.org.uk>, relay=none, delay=8860, delays=8860/0.03/0/0, dsn=4.4.1, status=deferred (connect to health.org.uk[xxx.xx.xx.x] :25: Connection refused)
The first statement is being refused by Hotmail. Is that correct?
The second statement is looking up our email domain health.org.uk and finding our website IP address rather than our internal exchange server...
Next steps please experts???
root@THF0091:/var/log# tail -f /var/log/mail.log Nov 12 14:49:19 THF0091 postfix/smtp[5388]: 51A9B81C9F: to=<aname@hotmail.co.uk>, relay=none, delay=332, delays=332/0.03/0/0, dsn=4.4.1, status=deferred (connect to mx2.hotmail.com[65.54.188.
Nov 12 14:49:19 THF0091 postfix/smtp[5386]: 5977881B6E: to=<aname@health.org.uk>, relay=none, delay=8860, delays=8860/0.03/0/0, dsn=4.4.1, status=deferred (connect to health.org.uk[xxx.xx.xx.x]
The first statement is being refused by Hotmail. Is that correct?
The second statement is looking up our email domain health.org.uk and finding our website IP address rather than our internal exchange server...
Next steps please experts???
Are you using your exchange server to relay the messages?
ASKER
Err yes. Sent straight from Nagios on Ubuntu to MS Exchnage 2007 on the same subnet then into my domain mailbox that is held on the Exchange 2007 server.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yessssssssssssssssss! Top man. Done, should of really know that. Thanks! Top Points!
Glad to be of service
Did you check this?
wmp