Nagios 2.03 not playing nice with mail program



I’m running Nagios on RH Enterprise with a cPanel front end. cPanel comes with Exim which I use as the defualt mail program for the domains I host on this box.

Nagios is configured properly in terms of alerts and web interface. The only problem is when sending out alerts. I only need to send out an alert to qn e-mail address. Following is the error message I get when manually forcing an alert as a test and using the command Nagios would use.

/usr/bin/printf “%b” “Service: HTTP\nHost: myhost\nAddress:\nState: CRITICAL\n
Info: $OUTPUT$\nDate: $DATETIME$” | /bin/mail -s “PROBLEM: myalias/HT
-bash: /bin/mail: Permission denied

So, I guess that the issue is permissions with the printf script in the /bin/mail directory. I tried changing permissions but received “Operation not Permitted”

Anyone with experience with Nagios and Exim please help.

Any and all help will be appreciated




You stated the error was " -bash: /bin/mail: Permission denied ", so it’s the permissions on /bin/mail

ls -la /bin/mail
-rwxr-xr-x 1 root mail 70740 Feb 21 14:42 /bin/mail


This is my output of ls -la /bin/mail

-rwxrwx— 1 bin mail 69276 Aug 1 2003 /bin/mail*



The command you stated will be run by nagios. Thus you need to change permission so nagios can access the /bin/mail in you permisions it stated that “Others” has no permission to access the file. Try changing the permission of /bin/mail to chmod 755 /bin/mail. Then try again.



Absolutely graemann, it’s there in black and white. Only bin and mail users can execute /bin/mail. The permission should be 755 as you stated, otherwise why have the mail command if nobody can execute it?


Thanks graemann! That was it. Now my phone is throwing all kinfs of SMS messages from my test hosts.