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

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
brianbelden
Posts: 20
Joined: Thu Jul 20, 2017 2:48 pm

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

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
brianbelden
Posts: 20
Joined: Thu Jul 20, 2017 2:48 pm

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

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
brianbelden
Posts: 20
Joined: Thu Jul 20, 2017 2:48 pm

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

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
brianbelden
Posts: 20
Joined: Thu Jul 20, 2017 2:48 pm

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

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
brianbelden
Posts: 20
Joined: Thu Jul 20, 2017 2:48 pm

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

Post 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.
brianbelden
Posts: 20
Joined: Thu Jul 20, 2017 2:48 pm

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

Post 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
Locked