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.
I configured notification method by both sms and mail, but if there is any service or host problem occurs, mail method doesn't work. and at same time i am getting below log in my nagios.debug log files
Still not getting notifications. is this something related to postfix then?. But i already checked that nagios user can send mail with mail, mailx, mutt commands without any issues.
Then, nake sure the path in the notification command matches the location in the which command provides. Then you will need to restart the nagios service
9 times out of 10 when you can run the command OK from the command line but it doesn't work as Nagios it is selinux or perhaps apparmor in the case of Ubuntu.
The only other sensible reason would be if user nagios couldn't execute the mail command. You might also double and triple check the path to the mail binary. It's in a nonstandard location on Debian based distributions.
root@fs:~# /etc/init.d/apparmor status
apparmor module is loaded.
5 profiles are loaded.
5 profiles are in enforce mode.
/sbin/dhclient
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/connman/scripts/dhclient-script
/usr/sbin/mysqld
/usr/sbin/tcpdump
0 profiles are in complain mode.
1 processes have profiles defined.
1 processes are in enforce mode :
/usr/sbin/mysqld (7911)
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.
apparmor is not blocking mail command anywhere also path for mail command looks correct, I checked tailf /var/log/audit/audit.log for apparmor blockage in realtime with nagios notifications but still no luck, none of logs showing errors.
Either way this is a system thing. We're here to help, but if the nagios.debug file indicates that it did `printf "somestuff" | /some/path/mail [email protected]` then that is indeed what it did. If you copy and paste that to the command line logged on as Nagios and it works then there is something "systemy" at play. Make sense?
If you don't believe me try replacing your mail command with `printf "somestuff" > /some/path/nagios/can/write/to/somefile`. Also, if you're thinking that maybe the mail command is running and the problem is actually beyond that, just tail your /var/log/maillog while sending your test notification.