Page 1 of 2

"Couldn't match /usr/bin/mailq output" after Debian Upgrade

Posted: Mon Apr 22, 2019 8:49 am
by brianbelden
Hello All,

I recently upgraded one of our Debian systems from Debian 7.11 to Debian 9.8. After the upgrade everything seems to be working as expected except for our monitoring server seems to have one error related to MailQ for the newly upgraded server. The Icinga checks on our monitoring server are all working fine with the exception of the MailQ check for the upgraded server. The output of this check is the following:

Couldn't match /usr/bin/mailq output

The service appears to be working fine though. I am getting email alerts server that was upgraded to Debian 9.8, but I just do not know how to fix this MailQ issue. Other Monitoring checks to this server are coming back fine as well. It appears to be related only to this MailQ check. Any help would be appreciated.

Thanks

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Mon Apr 22, 2019 3:34 pm
by benjaminsmith
Hi Brian,

Most likely an issue with file paths or permission settings. Can you post the entire command for this check from your configuration files? Are you able login as nagios user and run the command directly?

Thanks.

The following article is for Nagios XI, but much of the content applies to Core as well.
Nagios XI How to Test Check Commands from the Command Line

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Mon Apr 22, 2019 3:54 pm
by brianbelden
Hello,

Thank you for the reply. The command that is attempting to run is the following:

/usr/lib/nagios/plugins/check_nrpe -H <hostname> -t 30 -c check_mailq


I do not believe I can SSH into the server as Nagios user, but is there any way to run the command as the Nagios user?

Thanks

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Tue Apr 23, 2019 2:03 pm
by benjaminsmith
Hi Brian,

That plugin uses the mailq command on the server. Can you log into the Debian server and run the mailq command as root? Is it working?

The check_mailq Plugin
This plugin uses the system mailq command (sendmail) or qmail-stat (qmail)
to look at the queues. Mailq can usually only be accessed by root or
a TrustedUser. You will have to set appropriate permissions for the plugin to work.

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Wed Apr 24, 2019 7:28 am
by brianbelden
Hello,

Thank you for the reply. I logged into the server that I updated (not the monitoring server), and ran the command locally.

root:/usr/lib/nagios/plugins# ./check_nrpe -H 127.0.0.1 -t 30 -c check_mailq

Couldn't match /usr/bin/mailq output


I ran the command logged in as root.

Thanks

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Wed Apr 24, 2019 11:30 am
by benjaminsmith
Hi Brian,

What is the output of this command on that server?

Code: Select all

ls -l /usr/bin/mailq
Does exim -bp return the mail queue?

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Wed Apr 24, 2019 12:03 pm
by brianbelden
Hello,

Below is an output of ls -l on /usr/bin/mailq:

-rwsr-xr-x 1 mail root 18584 Jul 31 2016 /usr/bin/mailq

Is Exim -bp a command?

Thanks

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Wed Apr 24, 2019 12:41 pm
by benjaminsmith
Hi Brian,

It looks like the command is there but the plugin is not reading the output. Do you know which mail server/MTA is installed on the Debian server? I believe the default is exim. If that's the case, you might want to try adjusting the command to:

Code: Select all

check_mailq  -w 10 -c 20 -M exim
See the instructions for other options.

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Wed Apr 24, 2019 2:06 pm
by brianbelden
Hello,

Thank you for the reply.

When I enter the following command:

/usr/lib/nagios/plugins# ./check_mailq -w 10 -c 20 -M exim

I get the following output:

OK: exim mailq (0) is below threshold (10/20)|unsent=0;10;20;0

So it appears to give actual data using that command.

Re: "Couldn't match /usr/bin/mailq output" after Debian Upgr

Posted: Wed Apr 24, 2019 2:14 pm
by brianbelden
I updated the nrpe_local.cfg file and modified the Mailq check to the following:

command[check_mailq]=/usr/lib/nagios/plugins/check_mailq -w 2 -c 5 -M exim

I then restarted Nagios-nrpe-server.

After that restart the check on our monitoring server is now OK. It is no longer showing the Unknown error.

I believe this has been resolved now.

Thank you specifically to benjaminsmith for all your help!

Thanks