contacts.cfg is not working properly

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.
Locked
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: contacts.cfg is not working properly

Post by hsmith »

Can you try to use the command, and send it to one of the email logs, and post the log here for review ? I don't see anything wrong in the Nagios config files that you have posted.
Former Nagios Employee.
me.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: contacts.cfg is not working properly

Post by sinkak »

Code: Select all

sudo su nagios -c /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: test\n\nService: test\nHost: test\nAddress: test\nState: test\n\nDate/Time: test\n\nAdditional Info:\n\test\n" | /usr/bin/mail -s "** test Service Alert: test/test is test **" "[email protected]"

sudo su nagios -c /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: test\n\nService: test\nHost: test\nAddress: test\nState: test\n\nDate/Time: test\n\nAdditional Info:\n\test\n" | /usr/bin/mail -s "** test Service Alert: test/test is test **" "[email protected]"

Code: Select all

tail -f /var/log/mail.log
Oct 28 16:07:29 nagios-2015 postfix/qmgr[31700]: 05C5B42AC2: removed
Oct 28 16:09:01 nagios-2015 postfix/pickup[28138]: A968F42AC2: uid=1000 from=<ubuntu>
Oct 28 16:09:01 nagios-2015 postfix/cleanup[4813]: A968F42AC2: message-id=<20151028160901.A968F42AC2@ip-10-0-10-149>
Oct 28 16:09:01 nagios-2015 postfix/qmgr[31700]: A968F42AC2: from=<ubuntu@ip-10-0-10-149>, size=339, nrcpt=1 (queue active)
Oct 28 16:09:02 nagios-2015 postfix/smtp[7437]: A968F42AC2: to=<[email protected]>, relay=smtp17.msoutlookonline.net[64.78.22.100]:25, delay=0.39, delays=0.01/0/0.27/0.11, dsn=5.5.2, status=bounced (host smtp17.msoutlookonline.net[64.78.22.100] said: 504 5.5.2 <ubuntu@ip-10-0-10-149>: Sender address rejected: need fully-qualified address (in reply to RCPT TO command))
Oct 28 16:09:02 nagios-2015 postfix/cleanup[4813]: 26DD742AE0: message-id=<20151028160902.26DD742AE0@ip-10-0-10-149>
Oct 28 16:09:02 nagios-2015 postfix/qmgr[31700]: 26DD742AE0: from=<>, size=2332, nrcpt=1 (queue active)
Oct 28 16:09:02 nagios-2015 postfix/bounce[7449]: A968F42AC2: sender non-delivery notification: 26DD742AE0
Oct 28 16:09:02 nagios-2015 postfix/qmgr[31700]: A968F42AC2: removed
Oct 28 16:09:02 nagios-2015 postfix/local[4818]: 26DD742AE0: to=<ubuntu@ip-10-0-10-149>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Oct 28 16:09:02 nagios-2015 postfix/qmgr[31700]: 26DD742AE0: removed
Oct 28 16:09:07 nagios-2015 postfix/pickup[28138]: D1E5A42AC2: uid=1000 from=<ubuntu>
Oct 28 16:09:07 nagios-2015 postfix/cleanup[4813]: D1E5A42AC2: message-id=<20151028160907.D1E5A42AC2@ip-10-0-10-149>
Oct 28 16:09:07 nagios-2015 postfix/qmgr[31700]: D1E5A42AC2: from=<ubuntu@ip-10-0-10-149>, size=344, nrcpt=1 (queue active)
Oct 28 16:09:08 nagios-2015 postfix/smtp[7437]: D1E5A42AC2: to=<[email protected]>, relay=smtp17.msoutlookonline.net[64.78.22.100]:25, delay=0.38, delays=0.01/0/0.25/0.12, dsn=5.5.2, status=bounced (host smtp17.msoutlookonline.net[64.78.22.100] said: 504 5.5.2 <ubuntu@ip-10-0-10-149>: Sender address rejected: need fully-qualified address (in reply to RCPT TO command))
Oct 28 16:09:08 nagios-2015 postfix/cleanup[4813]: 4C40842AE0: message-id=<20151028160908.4C40842AE0@ip-10-0-10-149>
Oct 28 16:09:08 nagios-2015 postfix/qmgr[31700]: 4C40842AE0: from=<>, size=2352, nrcpt=1 (queue active)
Oct 28 16:09:08 nagios-2015 postfix/bounce[7449]: D1E5A42AC2: sender non-delivery notification: 4C40842AE0
Oct 28 16:09:08 nagios-2015 postfix/qmgr[31700]: D1E5A42AC2: removed
Oct 28 16:09:08 nagios-2015 postfix/local[4818]: 4C40842AE0: to=<ubuntu@ip-10-0-10-149>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Oct 28 16:09:08 nagios-2015 postfix/qmgr[31700]: 4C40842AE0: removed

sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: contacts.cfg is not working properly

Post by sinkak »

using command it doesnt work for both emails.
but from nagios i get alerts to warning email but not to critical email.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: contacts.cfg is not working properly

Post by sinkak »

Code: Select all

more /var/mail/ubuntu


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@ip-10-0-10-149>: Sender address
    rejected: need fully-qualified address


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@ip-10-0-10-149>: Sender address
    rejected: need fully-qualified address

Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.0.0
Remote-MTA: dns; mx-apac.mail.gm0.yahoodns.net
Diagnostic-Code: smtp; 501 Syntax error in parameters or arguments

it is failing for these email addresses ( [email protected],[email protected],[email protected]).
Command is working for only gmail address.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: contacts.cfg is not working properly

Post by hsmith »

See if this command works:

Code: Select all

echo "something" | usr/bin/mail -a "From:<USERNAME>@<YOURDOMAIN><.COM/NET/ORG/LOCAL> -s "Test" <YOUREMAILADDRESS>

In the logs your email is getting bounced because it is coming from root@localhost or something similar. It is not going to accept it unless it comes from a FQDN, [email protected].

Try that command, to your various emails, and post the results from the mail log please.
Former Nagios Employee.
me.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: contacts.cfg is not working properly

Post by sinkak »

Code: Select all

echo "something" | /usr/bin/mail -a "From:<ubuntu>@<nagios-2015><.COM/NET/ORG/LOCAL>" -s "Test" [email protected]

Code: Select all

Oct 28 18:18:29 nagios-2015 postfix/smtp[31841]: BB3A742AC2: to=<[email protected]>, relay=smtp17.msoutlookonline.net[64.78.22.100]:25, delay=0.37, delays=0.01/0/0.25/0.11, dsn=5.5.2, status=bounced (host smtp17.msoutlookonline.net[64.78.22.100] said: 504 5.5.2 <ubuntu@ip-10-0-10-149>: Sender address rejected: need fully-qualified address (in reply to RCPT TO command))
same error.
what should i use in sender address?


should i edit /etc/postfix/main.cf

but still alerts-warning email is working from [email protected]. it is not working for alerts-911 email.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: contacts.cfg is not working properly

Post by hsmith »

Code: Select all

echo "something" | /usr/bin/mail -a "From:[email protected]" -s "Test" [email protected]
Try this. It was rejected because it wasn't in the format of a FQDN.

We'll not mess with main.cf for now.
Former Nagios Employee.
me.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: contacts.cfg is not working properly

Post by sinkak »

still the same. i dont think it is taking from address from this command.

Code: Select all

echo "something" | /usr/bin/mail -a "From:[email protected]" -s "Test" [email protected]

Oct 28 19:07:18 nagios-2015 postfix/qmgr[31700]: 95DF142AC2: from=<ubuntu@ip-10-0-10-149>, size=302, nrcpt=1 (queue active)
Oct 28 19:07:19 nagios-2015 postfix/smtp[520]: 95DF142AC2: to=<[email protected]>, relay=smtp17.msoutlookonline.net[64.78.22.100]:25, delay=0.43, delays=0.01/0/0.28/0.14, dsn=5.5.2, status=bounced (host smtp17.msoutlookonline.net[64.78.22.100] said: 504 5.5.2 <ubuntu@ip-10-0-10-149>: Sender address rejected: need fully-qualified address (in reply to RCPT TO command))
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: contacts.cfg is not working properly

Post by hsmith »

Send it to your gmail address to verify it is coming from the correct address. I installed the same version of Ubuntu you are using so I would have matching files.
Former Nagios Employee.
me.
sinkak
Posts: 158
Joined: Thu Jul 30, 2015 1:30 pm

Re: contacts.cfg is not working properly

Post by sinkak »

it worked for gmail. i got mail from [email protected]

Code: Select all

 echo "something" | /usr/bin/mail -a "From:[email protected]" -s "Test" [email protected]


Oct 28 19:20:40 nagios-2015 postfix/qmgr[31700]: B6D7542AC2: from=<ubuntu@ip-10-0-10-149>, size=299, nrcpt=1 (queue active)
Oct 28 19:20:41 nagios-2015 postfix/smtp[8807]: B6D7542AC2: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.29.26]:25, delay=1.1, delays=0.01/0/0.9/0.14, dsn=2.0.0, status=sent (250 2.0.0 OK 1446060109 f23si43382736qhc.77 - gsmtp)
Oct 28 19:20:41 nagios-2015 postfix/qmgr[31700]: B6D7542AC2: removed
Oct 28 19:22:27 nagios-2015 postfix/pickup[32085]: 8052E42AC2: uid=106 from=<nagios>
Locked