LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   E-mail notifications not working with nagios (https://www.linuxquestions.org/questions/linux-server-73/e-mail-notifications-not-working-with-nagios-594874/)

hondo 10-26-2007 03:44 PM

E-mail notifications not working with nagios
 
Hi

The last time i was setting up nagios was on a quite big event and it worked like it should, but there was a problem with the e-mail notifications for nagios. Nagios was suppose to send out notifications when there were any problems with the servers, but this never happend / worked like it should. (Yes, i have read the nagios doc. and then also created the contact objects, contact groups etc.)

To troubleshoot this problem i first checked the nagios logs which indicated that nagios couldnt find the "mail" program which is used to send out the notification emails. It tried to look for the program in a directory on the system, but it wasnt the correct one. I fixed this problem with making a symlink from the directory the mail program was to the directory where nagios were looked for it. I now checked the logs for nagios again and it didnt say anything now about not finding the mail program and there was nothing that indicated that the emails werent sent..so they should then be sent. ..But even after a while (1 hour) i didnt receive any emails from nagios.

I now checked the mail logs for sendmail because i guess nagios is using this as the default MTA. There was no indication from these logs that the mails werent sent, so they should have been sent. I then looked in the mail queue where i found all the mails, lined up together, waiting to be sent. ..But after a while they just timed out, all of them.

I cant seem to see what the problem is there, nagios is sending mail when there is a problem, but the mail just stays in the mail queue and times out..what is wrong here? ..I have tried to remove all firewall, but there is no change at all. Port 25 is after what i understand the only one needed to be open for these email notifications to work..and it should be open.

I dont have the logs now from this, because this happened a some weeks ago now, but i still have some test config for nagios which have the exact same problem.

I would appericiate any help with this problem as it seems to be q tricky subject. Thanks.

scotlarsen 10-27-2007 02:44 PM

Where is nagios sending email notifications to? Is it to a mail server you manage? Can you manually send email using the mail program from your nagios server to the email address you have specified in nagios? I think the approach you want to take is to first figure out if it's a nagios problem, a sendmail problem or a network problem blocking port 25 (firewall, ISP, etc.).

hondo 10-28-2007 12:12 PM

Thanks for your reply. Nagios is sending email notifications to an email address specified in one of the contect objects. You bring up a pretty good point about trying to see if the mail program actully will send the mail. But, since the email has been sent to the mail queue i guess that there is nothing wrong with this program and that the problem would be more sendmail/network related. I cannot see how this would be a nagios problem, when the mail is being sent from nagios.

You dont have to have a mail server running to be able to send mail with the mail program, at least that would be weird ..and from where i stand, port 25 should be open, so it might be that the ISP is blocking it, is there any way to check this? I know my ISP is blocking port 80 (i dont know this was found out)..but im not sure if they block port 25. If they are blocking port 25, then why would they do this, so noone can send mail?

scotlarsen 10-28-2007 12:42 PM

$ dig mx domain_you_are_sending_mail_to

$ telnet mx_server_from_above 25

If you can see you are talking to the mail server port 25 is not blocked and if you can't:

# service iptables stop

and try again. If it's still blocked:

# service iptables start

If it's your iptables firewall causing the problem you'll have to make the appropriate changes to your iptables config and restart the service.

Your ISP is probably blocking port 25 (outbound) except to it's own smtp server(s) as many of them do nowadays in an effort to help thwart spammer attempts to exploit open relay mail servers (e.g. poorly configured ones).

If it is blocked (as is mine with my home ISP) you might want to look in to setting up sendmail to use your ISP's mail server as a mail relay. Note: you may have to setup sendmail to use smtp authentication to connect to your ISP's mail server.


All times are GMT -5. The time now is 01:37 AM.