Page 5 of 13

Re: contacts.cfg is not working properly

Posted: Wed Oct 07, 2015 3:59 pm
by hsmith
I am unsure whether or not you caught my edit on the post above, but we need to try running these commands as the user "nagios".
hsmith wrote:Can you post your commands.cfg for review? Also, you need to get logged in as the user 'nagios' to try to use that mail command. If you are unable to get logged in as this user, your Linux administrator should be able to help you get in. If you need to set a password for the nagios user, the command to do that would be passwd nagios, from there you would be able to log in to the account.

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 9:48 am
by sinkak
during initial set up i did

Code: Select all

     sudo useradd nagios
    sudo groupadd nagcmd
    sudo usermod -a -G nagcmd nagios
i dont know the password for user nagios?

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 10:01 am
by hsmith
Does the passwd nagios command not work?

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 10:29 am
by sinkak
i never gave a password for nagios during initial setup.
If i change password for nagios now, all the scripts and checks running with user nagios will fail?

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 10:38 am
by hsmith
It shouldn't, I have done it on my core installation without problem, but to be safe we can also use the following one-liner:

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" | /bin/mail -s "** test Service Alert: test/test is test **" "youremail"

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 10:43 am
by sinkak

Code: Select all

ubuntu@nagios-2015:~$ 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]"
Null message body; hope that's ok
ubuntu@nagios-2015:~$
i got this output. does that mean it went ok

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 10:45 am
by hsmith
I got the same output and still got the email, at my gmail address.

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 10:51 am
by sinkak
i am getting to my gmail too but not to those alerts-warning or alerts 911 email address.

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 10:54 am
by hsmith
If you're able to send to gmail, but not the other email addresses using the command I provided it is no longer something that Nagios is doing. Now I would say it is time to look at your email server logs and see what is happening. You can explore other solutions such as using SMTP on your Nagios Core machine, but first I would look at your email server and see if it is filtering.

Re: contacts.cfg is not working properly

Posted: Mon Oct 12, 2015 11:18 am
by sinkak
i checked with system admin. no filters on email server.

Code: Select all

 tail -f mail.log.1
Oct 11 06:38:18 nagios-2015 postfix/cleanup[23151]: 4549A457E8: message-id=<20151011063818.4549A457E8@ip-10-0-10-149>
Oct 11 06:38:18 nagios-2015 postfix/qmgr[1306]: 4549A457E8: from=<>, size=2423, nrcpt=1 (queue active)
Oct 11 06:38:18 nagios-2015 postfix/bounce[23157]: 408E9457D6: sender non-delivery notification: 4549A457E8
Oct 11 06:38:18 nagios-2015 postfix/qmgr[1306]: 408E9457D6: removed
Oct 11 06:38:18 nagios-2015 postfix/smtp[23156]: 4549A457E8: to=<nagios@ip-10-0-10-149>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.4.4, status=bounced (Host or d
omain name not found. Name service error for name=ip-10-0-10-149 type=AAAA: Host not found)
Oct 11 06:38:18 nagios-2015 postfix/qmgr[1306]: 4549A457E8: removed

nothing in mail log either.

i am getting updates sometimes from nagios to alerts-warning email but nothing to 911 email.