how to configure nagios sendmail after installing nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios sendmail after installing nagios

Post by sinkak »

ubuntu@nagios-2015:~$ /usr/bin/mail -v
Mail version 8.1.2 01/15/2001. Type ? for help.
"/var/mail/ubuntu": 27 messages 27 new
>N 1 MAILER-DAEMON@ip- Tue Oct 13 18:25 70/2319 Undelivered Mail Returned to Sender
N 2 MAILER-DAEMON@ip- Tue Oct 13 19:00 70/2300 Undelivered Mail Returned to Sender
N 3 MAILER-DAEMON@ip- Wed Oct 14 15:31 70/2300 Undelivered Mail Returned to Sender
N 4 MAILER-DAEMON@ip- Wed Oct 14 15:31 69/2280 Undelivered Mail Returned to Sender
N 5 MAILER-DAEMON@ip- Sun Oct 18 17:44 69/2206 Undelivered Mail Returned to Sender
N 6 MAILER-DAEMON@ip- Wed Oct 28 16:05 71/2421 Undelivered Mail Returned to Sender
N 7 MAILER-DAEMON@ip- Wed Oct 28 16:05 70/2402 Undelivered Mail Returned to Sender
N 8 MAILER-DAEMON@ip- Wed Oct 28 16:06 71/2421 Undelivered Mail Returned to Sender
N 9 MAILER-DAEMON@ip- Wed Oct 28 16:06 70/2402 Undelivered Mail Returned to Sender
N 10 MAILER-DAEMON@ip- Wed Oct 28 16:09 70/2402 Undelivered Mail Returned to Sender
N 11 MAILER-DAEMON@ip- Wed Oct 28 16:09 71/2421 Undelivered Mail Returned to Sender
N 12 MAILER-DAEMON@ip- Wed Oct 28 16:36 70/2402 Undelivered Mail Returned to Sender
N 13 MAILER-DAEMON@ip- Wed Oct 28 16:39 69/2308 Undelivered Mail Returned to Sender
N 14 MAILER-DAEMON@ip- Wed Oct 28 18:09 74/2412 Undelivered Mail Returned to Sender
N 15 MAILER-DAEMON@ip- Wed Oct 28 18:10 74/2412 Undelivered Mail Returned to Sender
N 16 MAILER-DAEMON@ip- Wed Oct 28 18:11 73/2393 Undelivered Mail Returned to Sender
N 17 MAILER-DAEMON@ip- Wed Oct 28 18:15 72/2453 Undelivered Mail Returned to Sender
N 18 MAILER-DAEMON@ip- Wed Oct 28 18:18 71/2434 Undelivered Mail Returned to Sender
N 19 MAILER-DAEMON@ip- Wed Oct 28 18:35 72/2412 Undelivered Mail Returned to Sender
N 20 MAILER-DAEMON@ip- Wed Oct 28 19:07 71/2364 Undelivered Mail Returned to Sender
N 21 MAILER-DAEMON@ip- Wed Nov 4 16:05 71/2384 Undelivered Mail Returned to Sender
N 22 MAILER-DAEMON@ip- Wed Nov 4 16:06 71/2384 Undelivered Mail Returned to Sender
N 23 MAILER-DAEMON@ip- Wed Nov 4 16:06 71/2384 Undelivered Mail Returned to Sender
N 24 MAILER-DAEMON@ip- Wed Nov 4 16:06 71/2384 Undelivered Mail Returned to Sender
N 25 MAILER-DAEMON@ip- Wed Nov 4 16:06 71/2384 Undelivered Mail Returned to Sender
N 26 MAILER-DAEMON@ip- Wed Nov 4 16:07 71/2384 Undelivered Mail Returned to Sender
N 27 MAILER-DAEMON@nag Wed Nov 4 16:24 71/2327 Undelivered Mail Returned to Sender
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: how to configure nagios sendmail after installing nagios

Post by hsmith »

Can you read one of those mails and see what it says?
Former Nagios Employee.
me.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios sendmail after installing nagios

Post by sinkak »

Date: Wed, 4 Nov 2015 16:24:10 +0000 (UTC)
From: MAILER-DAEMON@nagios-2015 (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: ubuntu@nagios-2015
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="11D1E42AC8.1446654250/nagios-2015"
Message-Id: <20151104162410.A6B8642F29@nagios-2015>

This is a MIME-encapsulated message.

--11D1E42AC8.1446654250/nagios-2015
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host nagios-2015.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

The mail system

<[email protected]>: host smtp17.msoutlookonline.net[64.78.22.100]
said: 504 5.5.2 <ubuntu@nagios-2015>: Sender address rejected: need
fully-qualified address (in reply to RCPT TO command)

--11D1E42AC8.1446654250/nagios-2015
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; nagios-2015
X-Postfix-Queue-ID: 11D1E42AC8
X-Postfix-Sender: rfc822; ubuntu@nagios-2015
Arrival-Date: Wed, 4 Nov 2015 16:24:10 +0000 (UTC)

Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.5.2
Remote-MTA: dns; smtp17.msoutlookonline.net
Diagnostic-Code: smtp; 504 5.5.2 <ubuntu@nagios-2015>: Sender address rejected:
need fully-qualified address

--11D1E42AC8.1446654250/nagios-2015
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <ubuntu@nagios-2015>
Received: by nagios-2015 (Postfix, from userid 1000)
id 11D1E42AC8; Wed, 4 Nov 2015 16:24:10 +0000 (UTC)
To: [email protected]
Subject: Test
From:[email protected]
Message-Id: <20151104162410.11D1E42AC8@nagios-2015>
Date: Wed, 4 Nov 2015 16:24:10 +0000 (UTC)

test nagios email

--11D1E42AC8.1446654250/nagios-2015--
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: how to configure nagios sendmail after installing nagios

Post by hsmith »

sinkak wrote:Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.5.2
Remote-MTA: dns; smtp17.msoutlookonline.net
Diagnostic-Code: smtp; 504 5.5.2 <ubuntu@nagios-2015>: Sender address rejected:
need fully-qualified address

Didn't we fix that in the thread before this one? Read back through that thread to see how to send from a fully qualified address.

https://support.nagios.com/forum/viewto ... 83#p159683
Former Nagios Employee.
me.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios sendmail after installing nagios

Post by sinkak »

No its not fixed in that thread.
They said it is mail issue not nagios issue and closed the thread.
i am trying to figure out may be i didnt configure mail with nagios properly during initial setup and trying to figure out how to configure mail with nagios after all the alerts are set up and everything else is working.
Thats why i opened this thread.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how to configure nagios sendmail after installing nagios

Post by rkennedy »

The issue is clear that it is not a Nagios problem, but rather a configuration issue -

Code: Select all

<[email protected]>: host smtp17.msoutlookonline.net[64.78.22.100]
said: 504 5.5.2 <ubuntu@nagios-2015>: Sender address rejected: need
fully-qualified address (in reply to RCPT TO command)
Can you please change your hostname to a FQDN?
Former Nagios Employee
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios sendmail after installing nagios

Post by sinkak »

changed it to nagios.website.com
this name is going to resolve back to its public ip.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how to configure nagios sendmail after installing nagios

Post by rkennedy »

While that is a FQDN, is it valid? If msoutlookonline.net rejects it then you will need to change it to a valid FQDN with PTR records set.

This is why your alerts were not working in the past, is because the server was rejecting them.
Former Nagios Employee
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: how to configure nagios sendmail after installing nagios

Post by sinkak »

Code: Select all

ubuntu@nagios:s$ echo "test nagios email" | /usr/bin/mail -a "From:[email protected]" -s "Test" [email protected]
You have mail in /var/mail/ubuntu

Code: Select all

<[email protected]>: host smtp17.msoutlookonline.net[64.78.22.100]
    said: 504 5.5.2 <ubuntu@nagios-2015>: Sender address rejected: need
    fully-qualified address (in reply to RCPT TO command)

--1EEBD4245D.1449593010/nagios-2015
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; nagios-2015
X-Postfix-Queue-ID: 1EEBD4245D
[b]X-Postfix-Sender: rfc822; ubuntu@nagios-2015[/b]
Arrival-Date: Tue,  8 Dec 2015 16:43:30 +0000 (UTC)

Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.5.2
Remote-MTA: dns; smtp17.msoutlookonline.net
Diagnostic-Code: smtp; 504 5.5.2 <ubuntu@nagios-2015>: Sender address rejected:
    need fully-qualified address

--1EEBD4245D.1449593010/nagios-2015
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <ubuntu@nagios-2015>
Received: by nagios-2015 (Postfix, from userid 1000)
        id 1EEBD4245D; Tue,  8 Dec 2015 16:43:30 +0000 (UTC)
To: [email protected]
Subject: Test
From:[email protected]
Message-Id: <20151208164330.1EEBD4245D@nagios-2015>
Date: Tue,  8 Dec 2015 16:43:30 +0000 (UTC)

test nagios email

--1EEBD4245D.1449593010/nagios-2015--

i changed the hostname from nagios-2015 to nagios.website.net but still i see nagios-2015 in sender id
i did change in /etc/hostname and /etc/hosts and restarted sudo service hostname restart
do i have to change anything else?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: how to configure nagios sendmail after installing nagios

Post by rkennedy »

Can you reboot the machine and post the output of the command hostname, and then try again?
Former Nagios Employee
Locked