This blog assumes that NRPE and nagios plugins are already installed on the remote server.
Remote OS: Centos 6.7
Nagios Server OS: Centos 5.7
WHM: 11.50.0
NRPE: 2.14
Remote server
Download the check_eximailqueue plugin (version 1.3 as of writing) from Nagios.org . Upload the plugin to the the Nagios plugin directory (/usr/lib64/nagios/plugins/) on the remote server
[RemoteServer]# vi /usr/lib64/nagios/plugins/check_eximailqueue
Uncomment the following line
#EXIM=/usr/local/exim/bin/exim
and add
EXIM=$(which exim)
Edit the nrpe.cfg
[RemoteServer]# vi /etc/nagios/nrpe.cfg command[check_exim_mailq]=/usr/lib64/nagios/plugins/check_eximailqueue -w 100 -c 200
Add sudo privileges to nagios user
[RemoteServer]# visudo nagios ALL=NOPASSWD:/usr/lib64/nagios/plugins/check_eximailqueue, /usr/sbin/exim
Nagios Server
Edit Nagios config and add following:
define service{ use generic-service host_name webhost10.jordansphere.co.uk service_description MailQ-Exim check_command check_nrpe!check_exim_mailq }
However, this still did not work. The following error appeared:
[NagiosServer]# ./check_nrpe -H webhost10.jordansphere.co.uk -c check_exim_mailq
Mailqueue WARNING – query returned no output!
It seems a lot of users out there struggling with this error. The fix is to add the following line to the /etc/sudoers file
Defaults:nagios !requiretty
Running this from Nagios server again I get the following output:
[NagiosServer]# ./check_nrpe -H webhost10.jordansphere.co.uk -c check_exim_mailq
Mailqueue OK – 0 messages on queue
Success !