Nagios and SendMail configuration issues

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
brianweeks22
Posts: 70
Joined: Fri Dec 21, 2012 12:26 pm

Nagios and SendMail configuration issues

Post 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
Attachments
commands-cfg.doc
(20 KiB) Downloaded 200 times
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios and SendMail configuration issues

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
brianweeks22
Posts: 70
Joined: Fri Dec 21, 2012 12:26 pm

Re: Nagios and SendMail configuration issues

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios and SendMail configuration issues

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
brianweeks22
Posts: 70
Joined: Fri Dec 21, 2012 12:26 pm

Re: Nagios and SendMail configuration issues

Post 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
brianweeks22
Posts: 70
Joined: Fri Dec 21, 2012 12:26 pm

Re: Nagios and SendMail configuration issues

Post by brianweeks22 »

also, in command.cfg it already appears to be using /bin/mail which is where I DO have mail...
brianweeks22
Posts: 70
Joined: Fri Dec 21, 2012 12:26 pm

Re: Nagios and SendMail configuration issues

Post by brianweeks22 »

Actually... That worked... Let me wait 30 minutes before I close this, but I just received my first notification!


THANK YOU!


Brian
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios and SendMail configuration issues

Post by abrist »

Great. Let us know when this thread is lock-ready. Cheers.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
brianweeks22
Posts: 70
Joined: Fri Dec 21, 2012 12:26 pm

Re: Nagios and SendMail configuration issues

Post by brianweeks22 »

It appears to be working well now!

Thanks for ALL of your help... Much appreciated



Thanks


Brian
Locked