LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-18-2009, 05:17 PM   #1
cazter2
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Rep: Reputation: 0
Nagios and Postfix Email Notifications


I have Nagios installed and running like a champ. But for the life of me I cannot get Nagios alerts to send properly through Postfix. What I want is for Postfix to send them out through my Exchange SMTP.

When sending a test mail message via Telnet I get:

554 5.7.1 <nagios@mydomain.com>: Relay access denied

Here is the /etc/postfix/main.cf:

#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = Nagios-SLC
mydomain = nagios-slc.local
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $mydomain, $myhostname
relayhost = smtp.mydomain.com
mynetworks = 192.168.3.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
myorigin = $mydomain
inet_protocols = ipv4
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
canonical_maps = hash:/etc/postfix/canonical


I am very possibly going about this cofiguration wrong but it was my understanding that the "relayhost" config would determine what SMTP to send from... which I currently have set as my Exchange SMTP.

Appreciate any help I can get.
 
Old 11-18-2009, 09:08 PM   #2
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: LFS-Version SVN-20091202, Arch 2009.08
Posts: 1,450

Rep: Reputation: 63
Quote:
554 5.7.1 <nagios@mydomain.com>: Relay access denied
This is telling you that your mail server prevents relay which is correct. Most email servers will prevent this sort of action due to spam bots and people using it to realy bad things. You may need to enable it for it to work. Tho I am not sure why it would need that on to send status emails. I am only familiar with using nagios at work not setting it up so its possible all of this is not helpful if so I apologize.
 
Old 11-19-2009, 12:05 AM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,034

Rep: Reputation: 97
Did you check the google because there are lot of discussion in this regards
http://www.google.lk/#hl=en&q=postfi...9afc25fb272570

Quote:
mynetworks = 192.168.3.0/24
add both network address range & localhost(127.0.0.0/8) and check

Last edited by kirukan; 11-19-2009 at 12:11 AM.
 
Old 11-19-2009, 12:20 AM   #4
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Hi,

You'll have to tell your Exchange SMTP server to accept mails from the Nagios server. I have mine configured to send to our Gmail for enterprises and works like a charm. And Postfix on my Nagios server accepts mails from all our LAN networks and relays them promptly to Google.

Code:
myhostname = srvnagios.domain.es
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = smtp.gmail.com, localhost, srvnagios.domain.es
relayhost = 
mynetworks = 172.25.0.0/16,127.0.0.0/8,192.168.0.0/16,10.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = localhost,172.25.192.35
canonical_maps = hash:/etc/postfix/canonical
relay_domains = srvnagios.tradisa.es
Kind regards,

Eric
 
Old 11-19-2009, 10:24 AM   #5
cazter2
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by exvor View Post
This is telling you that your mail server prevents relay which is correct. Most email servers will prevent this sort of action due to spam bots and people using it to realy bad things. You may need to enable it for it to work. Tho I am not sure why it would need that on to send status emails. I am only familiar with using nagios at work not setting it up so its possible all of this is not helpful if so I apologize.
I have added the Linux box IP as a trusted relay to my Exchange server and still get the same problem. I am wondering if I need to have the linux box hostname and domain changed to match those of the Exchange box?

Quote:
Originally Posted by kirukan View Post
Did you check the google because there are lot of discussion in this regards
http://www.google.lk/#hl=en&q=postfi...9afc25fb272570


add both network address range & localhost(127.0.0.0/8) and check
I am continuously reading through everything Google is able to pull up.


All I want is for Nagios to be able to send out alerts to a local distribution group. I know it has to be simple and I am probably over thinking it... /sigh
 
Old 11-19-2009, 10:33 AM   #6
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Did you change the relayhost variable in your config and reload/restart postfix? Have you noticed my relayhost variable is empty? And the Google smtp is in the mydestination variable?

In your config the mydestination should point to your exchange server and probably your localhost/nagiosserver combination to accept mails from Nagios.

Change that if you haven't, restart postfix and try again.

Kind regards,

Eric
 
Old 11-19-2009, 12:06 PM   #7
cazter2
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by EricTRA View Post
Did you change the relayhost variable in your config and reload/restart postfix? Have you noticed my relayhost variable is empty? And the Google smtp is in the mydestination variable?

In your config the mydestination should point to your exchange server and probably your localhost/nagiosserver combination to accept mails from Nagios.

Change that if you haven't, restart postfix and try again.

Kind regards,

Eric
I made the changes you suggested and no longer get the: 554 5.7.1 <nagios@mydomain.com>: Relay access denied, error. THanks!

But the test mail is not hitting in my inbox and I don't see an SMTP session being established on my Exchange server.

Still running test emails with slightly different settings each time but so far, zilch
 
Old 11-19-2009, 12:14 PM   #8
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Can you connect using telnet to the Exchange server:
Code:
telnet your_server 25
Once connected issue the following commands:
Code:
user yourusername <enter>
pass yourpassword <enter>
MAIL FROM: yourmail@yourdomain.com
RCPT TO: yourmail@yourdomain.com
DATA some text
CTRL-D
then
Code:
quit
to end the session.

That at least will confirm that you are able to connect to the Exchange server correctly and send mail through it.

Also look in the syslog and messages log to see for strange behavior.

Post any results please.

Kind regards,

Eric
 
Old 11-19-2009, 12:23 PM   #9
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
That is FROM the Nagios server of course to the Exchange, sorry for not mentioning that.

Kind regards,

Eric
 
Old 11-19-2009, 01:07 PM   #10
cazter2
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by EricTRA View Post
Can you connect using telnet to the Exchange server:
Code:
telnet your_server 25
Once connected issue the following commands:
Code:
user yourusername <enter>
pass yourpassword <enter>
MAIL FROM: yourmail@yourdomain.com
RCPT TO: yourmail@yourdomain.com
DATA some text
CTRL-D
then
Code:
quit
to end the session.

That at least will confirm that you are able to connect to the Exchange server correctly and send mail through it.

Also look in the syslog and messages log to see for strange behavior.

Post any results please.

Kind regards,

Eric
I ran the following sucessfully:

root@Nagios-SLC:~# telnet mail.domain.com 25
Trying 192.168.3.10...
Connected to mail.domain.com.
Escape character is '^]'.
220 mail.domain.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Thu, 19 Nov 2009 11:28:44 -0700
MAIL FROM: nagios@domain.com
503 5.5.2 Send hello first
HELO nagios-slc.domain.com
250 mail.domain.com Hello [192.168.3.215]
MAIL FROM: nagios@domain.com
250 2.1.0 nagios@domain.com....Sender OK
RCPT TO: alert@domain.com
250 2.1.5 alert@domain.com
data
354 Start mail input; end with <CRLF>.<CRLF>
test!7
.
250 2.6.0 <PCDC1QVVRBjw60JOXHD00005a43@mail.domain.com> Queued mail for delivery


Hit my inbox right away.

For some reason the linux box doesnt seem to be sending mail out, grr.
 
Old 11-19-2009, 01:19 PM   #11
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Did you look in the logs for specific messages in regards to postfix when you tried to send a message? This time try using the mail command:
Code:
mail -s "TEST SUBJECT LINE" youruser@domain.com
CTRL-D
and check the logs again. Put relevant info from the logs here please. The mail command is the one that's used by Nagios if I recall correct.

You at least narrowed the problem down a lot in my opinion since now you can connect and mail to the Exchange server. So only thing to check is the linux box as you stated

Kind regards,

Eric
 
Old 11-19-2009, 01:58 PM   #12
cazter2
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Original Poster
Rep: Reputation: 0
These errors are all throughout mail.log

Nov 19 11:47:28 Nagios-SLC postfix/smtp[5951]: fatal: open database /etc/postfix/sasl_passwd.db: No such file or directory
Nov 19 11:47:29 Nagios-SLC postfix/master[5113]: warning: process /usr/lib/postfix/smtp pid 5951 exit status 1
Nov 19 11:47:29 Nagios-SLC postfix/master[5113]: warning: /usr/lib/postfix/smtp: bad command startup -- throttling
Nov 19 11:48:29 Nagios-SLC postfix/smtp[5957]: fatal: open database /etc/postfix/sasl_passwd.db: No such file or directory
Nov 19 11:48:30 Nagios-SLC postfix/master[5113]: warning: process /usr/lib/postfix/smtp pid 5957 exit status 1
Nov 19 11:48:30 Nagios-SLC postfix/master[5113]: warning: /usr/lib/postfix/smtp: bad command startup -- throttling
Nov 19 11:49:30 Nagios-SLC postfix/smtp[5958]: fatal: open database /etc/postfix/sasl_passwd.db: No such file or directory
Nov 19 11:49:31 Nagios-SLC postfix/master[5113]: warning: process /usr/lib/postfix/smtp pid 5958 exit status 1


Other then that I do not see anything overly significant.
 
Old 11-19-2009, 02:05 PM   #13
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
Could you comment out the following lines in your main.cf
Code:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
so that they show like this:
Code:
#smtp_sasl_auth_enable = yes
#smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
#smtp_sasl_security_options =
then restart postfix, try the mail command again and post what's in the log file please?

Kind regards,

Eric
 
Old 11-19-2009, 02:09 PM   #14
cazter2
LQ Newbie
 
Registered: Nov 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Fixed the above errors by commenting out the SMTP balonni in the config.

Thanks
 
Old 11-19-2009, 02:12 PM   #15
EricTRA
Guru
 
Registered: May 2009
Location: Barcelona, Spain
Distribution: LMDE Gnome with Awesome WM + Kernel 3.3.0-1 amd64
Posts: 6,518
Blog Entries: 1

Rep: Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217Reputation: 1217
So everything working? If so, you can mark the thread as solved using the thread tools.

And you're welcome.

Kind regards,

Eric
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios: Server Notifications DaveQB Linux - Software 3 03-26-2009 09:02 PM
Advanced Notifications with Nagios matisq Linux - Server 9 01-06-2009 03:04 AM
Nagios Email notifications jackie001 Linux - Newbie 3 11-14-2008 10:58 AM
Nagios e-Mail notifications netmaster3620 Linux - Newbie 1 07-01-2008 07:33 PM
Nagios notifications nuganen Linux - Newbie 1 06-20-2008 02:13 PM


All times are GMT -5. The time now is 11:16 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration