LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   help required with nagios email notifications (https://www.linuxquestions.org/questions/linux-newbie-8/help-required-with-nagios-email-notifications-779564/)

NewtoUbuntu8.1 01-03-2010 10:05 AM

help required with nagios email notifications
 
I am trying to get E-Mail notifications working in Nagios 3.2. I have configured Nagios to monitor 5 hosts and over 10 services. I am running Nagios on Ubuntu 9.10

The problem is that I cannot for the life of me get E-Mail notifications working

when I check the Mail Log I am getting a mail bounced message with unknown user statement.

here is an entry from the mail.log

Jan 3 15:51:45 John-Ubuntu postfix/pickup[27948]: 3EFCA40AB7: uid=1001 from=<nagios>

Jan 3 15:51:45 John-Ubuntu postfix/cleanup[28609]: 3EFCA40AB7: message-id=<20100103155145.3EFCA40AB7@John-Ubuntu>

Jan 3 15:51:45 John-Ubuntu postfix/qmgr[27949]: 3EFCA40AB7: from=<nagios@workemail.com>, size=533, nrcpt=1 (queue active)

Jan 3 15:51:45 John-Ubuntu postfix/local[28615]: 3EFCA40AB7: to=<itmanager@workemail .com>, relay=local, delay=0.34, delays=0.21/0.04/0/0.09, dsn=5.1.1, status=bounced (unknown user: "itmanager")

Jan 3 15:51:45 John-Ubuntu postfix/cleanup[28609]: 7611740AB8: message-id=<20100103155145.7611740AB8@John-Ubuntu>

Jan 3 15:51:45 John-Ubuntu postfix/qmgr[27949]: 7611740AB8: from=<>, size=2254, nrcpt=1 (queue active)

Jan 3 15:51:45 John-Ubuntu postfix/bounce[28616]: 3EFCA40AB7: sender non-delivery notification: 7611740AB8

Jan 3 15:51:45 John-Ubuntu postfix/qmgr[27949]: 3EFCA40AB7: removed

Jan 3 15:51:45 John-Ubuntu postfix/local[28615]: 7611740AB8: to=<nagios@workemail .com>, relay=local, delay=0.14, delays=0.07/0/0/0.07, dsn=2.0.0, status=sent (delivered to mailbox)

Jan 3 15:51:45 John-Ubuntu postfix/qmgr[27949]: 7611740AB8: removed

Can anybody PLEASE point me in the right direction to solve this problem.

EricTRA 01-03-2010 10:19 AM

Hi,

In order to get the email notifications working you'll need to direct the mail to a real email server. Do you have that setup on your server too? Or do you want to relay the mails to an external mail server using a MTA like postfix? Looks like you're just sending to local mail server. You'll need at least a server set up to accept those mails and then the tools to read them, being command line or via pop/imap/web protocol.

Kind regards,

Eric

NewtoUbuntu8.1 01-03-2010 10:43 AM

Hi Eric, I want to relay the mails to an external mail server! I have installed postfix onto the machine

EricTRA 01-03-2010 10:50 AM

Hello,

Ok, postfix can do the job if you configure it correctly. To what external server are you going to relay? Gmail, Yahoo, Hotmail? If one of these, are you behind a static WAN IP? The reason I ask this is because the mentioned email servers don't accept relaying from dynamic IP, so you might have to use some tricks. If relaying to for example you're own company's mailserver then it should be easy enough to set up.

Kind regards,

Eric

NewtoUbuntu8.1 01-03-2010 10:57 AM

Hi,
I want to relay the notifications to our own company's mailserver

EricTRA 01-03-2010 11:07 AM

Hi,

Then there are two parts you have to take into account. First you'll have to relay all the mail on your nagios server to the mailserver of your company. Second you'll have to tell your mailserver to accepts mails coming from your nagios server.

The main.cf (postfix main configuration file) should hold something like this:
Code:

myhostname = yournagios.serverhostname.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = yourmailserver.hostname.com, localhost, srvnagios.domain.es
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = localhost
canonical_maps = hash:/etc/postfix/canonical
relay_domains = yournagios.serverhostname.com

Of course you'll have to change the fictive domain names I put in there.
After changing config don't forget to reload or restart postfix.

The second part is up to you, to tell your mailserver to accept mails from your nagios server (allow relaying for that server).

Kind regards,

Eric

NewtoUbuntu8.1 01-03-2010 12:16 PM

Hi,
I edited the main.cf file, restarted postfix, restarted nagios and then forced an alarm from one of the hosts, in the log I got the following entry:

an 3 18:13:07 John-Ubuntu postfix/cleanup[27266]: fatal: open database /etc/postfix/canonical.db: No such file or directory
Jan 3 18:13:08 John-Ubuntu postfix/master[26530]: warning: process /usr/lib/postfix/cleanup pid 27266 exit status 1
Jan 3 18:13:08 John-Ubuntu postfix/master[26530]: warning: /usr/lib/postfix/cleanup: bad command startup -- throttling

kind regards

John

EricTRA 01-03-2010 12:20 PM

Hi,

Delete the line that says:
Code:

canonical_maps = hash:/etc/postfix/canonical
in your main.cf file and restart postfix. Then try again. That was my mistake, sorry about that.

Kind regards,

Eric

NewtoUbuntu8.1 01-03-2010 12:29 PM

Hi Eric,

It looks very promising now the entry in the log now states:
Queued mail for delivery.

When I am back in work tomorrow I will check it all out.
Thanks a million for you assistance, if I have any further problems I will add a new entry to this post.

Thanks again.

Kind Regards

John

EricTRA 01-03-2010 12:32 PM

Hi John,

Glad to hear that. And you're welcome, that's what the Linux community and LQ is all about in my opinion, to help each other and in doing so grow bigger then Mickey$oft ever imagined.

Kind regards,

Eric

NewtoUbuntu8.1 01-03-2010 12:33 PM

Hi Eric,
Just to let you know that the emails are now being sent out OK, I have just received notification via my blackberry.

Problem Solved.

Kind Regards

John

EricTRA 01-03-2010 12:34 PM

Hello John,

That's the fastest confirmation ever :) If you consider this thread as solved you can mark it as such by using the Thread Tools.

Kind regards,

Eric

tagzfernando 02-15-2011 12:36 AM

relay notifications to GMAIL
 
Hi Eric,

I have the same problem but in my case I'm using GMAIL in relaying notifications.Do you have any work around on this case?


Thanks,
Tagz

rockoboyt 10-13-2011 03:10 PM

sendmail in nagios
 
I can't seem to get any of my email notifications to go out. i've followed everything in the steps in this article and still not working. Here's what the log is showing...

Oct 13 15:48:06 monitor1 sendEmail[27228]: WARNING => SMTP-AUTH: No mutually supported authentication methods available
Oct 13 15:48:06 monitor1 sendEmail[27228]: ERROR => ERROR => SMTP-AUTH: Authentication to mail.myserver.net:25 failed.


All times are GMT -5. The time now is 03:20 AM.