LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-17-2014, 10:18 AM   #1
aagaag
Member
 
Registered: Aug 2014
Posts: 42

Rep: Reputation: Disabled
Nagios mail notifications


Hello, I have set up Nagios4 with Ubuntu14, and everything works fine. I have also set up Postfix to use a smarthost (smtp.hispeed.ch) which accepts plain auth (userid, pwd). That also works fine and I can send mail via postfix by telnetting into localhost smtp.
However, when Nagios tries to send notifications, they appear to get rejected by the smtp.hispeed.ch provider. The log says:

Aug 17 17:08:42 VmLinux postfix/pickup[13747]: 3B9B1182CD6B: uid=1001 from=<nagios@VmLinux>
Aug 17 17:08:42 VmLinux postfix/cleanup[13877]: 3B9B1182CD6B: message-id=<20140817150842.3B9B1182CD6B@VmLinux>
Aug 17 17:08:42 VmLinux postfix/qmgr[1844]: 3B9B1182CD6B: from=<nagios@VmLinux>, size=667, nrcpt=1 (queue active)
Aug 17 17:08:42 VmLinux postfix/smtp[13879]: connect to smtp.hispeed.ch[2001:730:3e10:0:213:46:255:24]:25: Network is unreachable
Aug 17 17:08:42 VmLinux postfix/smtp[13879]: 3B9B1182CD6B: to=<adriano.123@usz.ch>, relay=smtp.hispeed.ch[213.46.255.24]:25, delay=0.49, delays=0.13/0.01/0.31/0.04, dsn=5.1.0, status=bounced (host smtp.hispeed.ch[213.46.255.24] said: 550 5.1.0 <nagios@vmlinux> sender rejected (in reply to MAIL FROM command))
Aug 17 17:08:42 VmLinux postfix/cleanup[13877]: ACB81182CD76: message-id=<20140817150842.ACB81182CD76@VmLinux>
Aug 17 17:08:42 VmLinux postfix/qmgr[1844]: ACB81182CD76: from=<>, size=2457, nrcpt=1 (queue active)
Aug 17 17:08:42 VmLinux postfix/bounce[13880]: 3B9B1182CD6B: sender non-delivery notification: ACB81182CD76
Aug 17 17:08:42 VmLinux postfix/qmgr[1844]: 3B9B1182CD6B: removed
Aug 17 17:08:42 VmLinux postfix/local[13881]: ACB81182CD76: to=<nagios@VmLinux>, relay=local, delay=0.09, delays=0.04/0.01/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)

What might be wrong? Methinks that the authentication goes fine with telnet, but for some reason the messages sent by Nagios do not get authenticated. Many thanks in advance for any help! I am guessing that the "Network is unreachable" message relates to the non-existance of a IPv6 host and can be disregarded.
 
Old 08-17-2014, 11:25 PM   #2
markhahn
LQ Newbie
 
Registered: Jan 2011
Posts: 16

Rep: Reputation: 4
This is one of those cases where extra messages obscure the simple error. the "sender rejected" part is the relevant bit: your machine is presenting a bogus "From: nagios@VmLinux" line. just fully qualify that address and it'll be OK. (this can sometimes be done in the mail-generating config, but is probably better if you handle it at the system level, such as myorigin in postfix, or just setting hostname properly...)
 
Old 08-18-2014, 05:38 AM   #3
shuja_khan
LQ Newbie
 
Registered: Nov 2008
Posts: 11

Rep: Reputation: 0
postfix conf

A very simple postfix conf, adjust accordingly, this is not specific to Ubuntu, just postfix is required, additionally set SPF record for your IP as allowed sender for your sender domain, ignore TLS part, that's specific to my settings.




# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#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 = your-host-name.domain-name.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = cluster, localhost.localdomain, , localhost
relayhost =
mynetworks = 127.0.0.0/8 192.168.1.0/16 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
main.cf (END)
 
Old 08-22-2014, 11:51 PM   #4
aagaag
Member
 
Registered: Aug 2014
Posts: 42

Original Poster
Rep: Reputation: Disabled
Thank you all for your kind help. You have correctly directed me to the error in the email qualification. I decided to fix this in Nagios rather than Postfix, since the latter may have affected other Postfix-dependent applications as well.

I had some trouble finding the Nagios option which would allow for changing the originator email. The flag that needs to be added to the Nagios "host-notify-by-mail" or "service-notify-by-mail" commands in the file "commands.cfg" reads as follows:

-a "From: john.doe@uzh.ch"

Note that the quotation marks are essential!
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
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
E-mail notifications not working with nagios hondo Linux - Server 3 10-28-2007 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration