Page 1 of 1

Nagios and SendMail configuration issues

Posted: Wed Mar 06, 2013 5:36 pm
by brianweeks22
Good Afternoon

I am having an issue with nagios and sendmail. I have both installed on a CentOS6 box. from the CMD line "I CAN" successfully send internally and externally. the emails come from [email protected]

however.. I CANNOT get nagios to send the alerts. I am using nagios 3.2.3 and here is some information below

this is from the maillog
rodan2 sendmail[1525]: STARTTLS=client, relay=mx1.emailsrvr.com., version=TLSv1/SSLv3, verify=FAIL, cipher=AES256-SHA, bits=256/256


rodan2 sendmail[1525]: r26M3Scb001522: to=<[email protected]>, ctladdr=<[email protected]> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120311, relay=mx1.emailsrvr.com. [50.57.0.16], dsn=2.0.0, stat=Sent (Ok: queued as B6/33-12662-8ACB7315)



and this is from nagios.log

[1362604830] Warning: Attempting to execute the command "/usr/bin/printf "%b" "***** Nagios 1.0b6 *****\n\nNotification Type: PROBLEM\nHost: NagiosNAME\nState: DOWN\nAddress: 10.1.1.249\nInfo: $OUTPUT$\n\nDate/Time: $DATETIME$\n" | /usr/bin/Mail -s "Host DOWN alert for NagiosNAME!" [email protected]" resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...

i know that the hostgroups.. contacts.. etc are all set up correctly, as I copied these from a working server...



I have also attached a copy of my commands.cfg

any help would be greatly appreciated...

Thanks

Brian

Re: Nagios and SendMail configuration issues

Posted: Wed Mar 06, 2013 5:56 pm
by abrist
Have you tried running the command from the cli as the *nagios* user? You have to make sure that nagios has rights to /usr/bin/Mail.

Re: Nagios and SendMail configuration issues

Posted: Thu Mar 07, 2013 9:25 am
by brianweeks22
I have /bin/mail - but under /usr/bin/ I only have mailq and mailq.sendmail.. Is this an issue?

is there a command that I can run to send as nagios user? or do i just log in as that user?


Thanks

Re: Nagios and SendMail configuration issues

Posted: Thu Mar 07, 2013 10:58 am
by abrist
brianweeks22 wrote:I have /bin/mail - but under /usr/bin/ I only have mailq and mailq.sendmail.. Is this an issue?
Yes, and that would explain the following error:
brianweeks22 wrote:resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists...
You will need to alter the command to use one of the mail clients on your system. You may be able to symlink your mail binary to the notification command's expected location:

Code: Select all

ln -s /bin/mail /usr/bin/Mail
is there a command that I can run to send as nagios user? or do i just log in as that user?
You can just su over to the nagios user before testing the command:

Code: Select all

su nagios

Re: Nagios and SendMail configuration issues

Posted: Thu Mar 07, 2013 11:11 am
by brianweeks22
Thank You

I can successfully send as nagios user.. I ran the cmd that you send ln -s /bin/mail /usr/bin/Mail

Nagios is still not sending? same error code 127

Re: Nagios and SendMail configuration issues

Posted: Thu Mar 07, 2013 11:14 am
by brianweeks22
also, in command.cfg it already appears to be using /bin/mail which is where I DO have mail...

Re: Nagios and SendMail configuration issues

Posted: Thu Mar 07, 2013 11:18 am
by brianweeks22
Actually... That worked... Let me wait 30 minutes before I close this, but I just received my first notification!


THANK YOU!


Brian

Re: Nagios and SendMail configuration issues

Posted: Thu Mar 07, 2013 11:28 am
by abrist
Great. Let us know when this thread is lock-ready. Cheers.

Re: Nagios and SendMail configuration issues

Posted: Thu Mar 07, 2013 1:05 pm
by brianweeks22
It appears to be working well now!

Thanks for ALL of your help... Much appreciated



Thanks


Brian