Problem:
I was trying to add mail Queue monitoring for sendmail mta with the default check_mailq plugin. check_mailq was queried using nrpe which was demonized under xinetd. Even after the basic configuration, nrpe started crying about some access related problem (nrpe checks were called by nagios user)
[root@blackbox libexec]# ./check_nrpe -H localhost -c mailq
CRITICAL: Error code 78 returned from /usr/bin/mailq
[root@blackbox libexec]#
Solution:
1. Checked nrpe.cfg and verified that the configuration is correct --> Positive
[root@blackbox libexec]# grep mailq /usr/local/nagios/etc/nrpe.cfg
command[mailq]=/usr/local/nagios/libexec/check_mailq -M sendmail -w 40 -c 50
[root@blackbox libexec]#
2. Added sudo privileges for nagios user to run /usr/bin/mailq without password
[root@blackbox libexec]# grep mailq /etc/sudoers
nagios BLACKBOX_HOSTS = (root) NOPASSWD: /usr/bin/mailq
[root@blackbox libexec]#
3. Added the missing /usr/bin/sudo command on check_mailq script from nagios pluggins package. PATH_TO_MAILQ is called from utils.pm module
[root@blackbox libexec]# grep sudo /usr/local/nagios/libexec/check_mailq
if (! open (MAILQ, "/usr/bin/sudo $utils::PATH_TO_MAILQ | " ) ) {
[root@blackbox libexec]#
Yayy!! Its working..
[root@blackbox libexec]# ./check_nrpe -H localhost -c mailq
OK: mailq is empty|unsent=0;40;50;0
[root@blackbox libexec]#
Nagios check_mailq pluggin failing
Thursday, September 23, 2010 Posted by admin at 9:38 AM | Labels: check_mailq, mailq, nagios, nrpe, sendmail
Subscribe to:
Post Comments (Atom)
3 comments:
It will not work until you add below line to visudo file.
Default:nagios !requiretty
Raj, i did not need that to work. But thanks for the tip anyway.
Found the issue for me in /var/log/maillog
sendmail[21175]: NOQUEUE: SYSERR(nagios): can not chdir(/var/spool/mqueue/): Permission denied
the solution was allowing the nagios user to write to /var/spool/mqueue and adding them to the mail group.
Not sure if this solution is better then adding /usr/bin/sudo to the path, YMMV.
Post a Comment