Solve: check_mailq ERROR: is not executable by (uid 0:gid(0 10 6 4 3 2 1 0))

Overview

If you are looking to monitor mail queue of a mail server such as qmail, nagios provide a plugin called check_mailq. I recently used it on a server running qmail however it did not run out of the box. After fighting it for about half an hour I made it to work as I like, this post just explains what all I did. Hope this helps someone.

Solve: check_mailq ERROR: is not executable by (uid 0:gid(0 10 6 4 3 2 1 0))

First make sure you use -M switch to tell the plugin the mail client you are using, I am using qmail.


# /usr/local/nagios/libexec/check_mailq -M qmail -w 100 -c 200

Next edit the utils.pm file and set the path qmail-qstat binary path. To find where the qmail-stat reside, use which or find command.


# which qmail-qstat
/usr/sbin/qmail-qstat

# vi /usr/local/nagios/libexec/utils.pm

$PATH_TO_QMAIL_QSTAT = "/usr/sbin/qmail-qstat";

Then you have to edit the plugin and set the $ENV{‘PATH’} to /usr/bin as show.


# vi /usr/local/nagios/libexec/check_mailq

$ENV{'PATH'}='/usr/bin';

If you still get the error, make nagios user the member of qmail group.


# vi /etc/group

qmail:x:128:nagios