If you are icinga/nagios user and dealing with exim, you probably know for wonderful plugin check_eximailqueue. This plugin warns you when there are specific amount of email in your exim mail queue. Usually this indicates spam.
I installed this plugin on CentOS 7 with Directadmin installed. When I was executing plugin locally, it worked fine. But when I tried to execute it remotely (from Icinga server), it failed.
This was error returned when executing from Icinga server:
> # /usr/local/libexec/nagios/check_nrpe -H my.serverhostname.com -c check_exim_queue Mailqueue WARNING - query returned no output!
I added “nagios ALL=(ALL) NOPASSWD:/usr/sbin/exim” to my /etc/sudoers file but error still persisted. I manually set Exim and sudo path in script. Error was still there.
If you check your nrpe process, you’ll see that it runs by nrpe user and not nagios!
[root@da ~]# ps -aux | grep nrpe
nrpe 26993 0.0 0.0 46356 1460 ? Ss 10:44 0:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
Solution is very simple. Just change “nagios ALL=(ALL) NOPASSWD:/usr/sbin/exim” to “nrpe ALL=(ALL) NOPASSWD:/usr/sbin/exim” in your /etc/sudoers – replace user nagios with nrpe. It should work.
I hope it helps 🙂
Recent Comments