check_mailq plugin issues

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.
Locked
btom
Posts: 4
Joined: Wed Oct 16, 2013 10:17 am

check_mailq plugin issues

Post by btom »

Hello,

I am looking for any insight to an issue that i hope is something very obvious that i have overlooked, but am having no luck solving myself.


I have a nagios server that is monitoring mail queue levels using the check_mailq plugin. All the hosts but the local machine are working fine (others are over nrpe). On the local host i have the following setup:

Code: Select all

define command{
        command_name    check_mailqns1
        command_line    /usr/bin/sudo /usr/lib64/nagios/plugins/check_mailq -w 200 -c 300
        }

Code: Select all

define service{
        use                             local-service
        host_name                       ns1
        service_description          Mailserver Queue
        check_command               check_mailqns1
        }
and in the /etc/sudoers

Code: Select all

nagios ALL=(ALL) NOPASSWD: ALL
I can execute the command as the user nagios from the command line

Code: Select all

-bash-4.1$ /usr/bin/sudo /usr/lib64/nagios/plugins/check_mailq -w 200 -c 300
OK: mailq (83) is below threshold (200/300)|unsent=83;200;300;0
without and problems. However when nagios runs the check it returns:

Code: Select all

Current Status:	  WARNING 
Status Information:	(null)
I have tried defining the loopback address (127.0.0.1) and the eth0 ip address just to be sure.

I am just a bit confused and im not sure what else to go about trying next. As a side note, the mta is sendmail on this machine.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_mailq plugin issues

Post by abrist »

what are the permissions for check_mailq?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
btom
Posts: 4
Joined: Wed Oct 16, 2013 10:17 am

Re: check_mailq plugin issues

Post by btom »

Permissions:

Code: Select all

[root@ns1 ~]# ls -al /usr/lib64/nagios/plugins/ | grep mailq
-rwxr-xr-x. 1 root root    20286 Aug 17  2012 check_mailq
It looks like those applied to the check_mailq are the same as the others in the directory as well.

Just to double though check i went ahead and changed the check_mailq to nagios:nagios however the output from the nagios service status page remained the same after forcing a service check.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mailq plugin issues

Post by slansing »

Can you attach a copy of the plugin you are using? Thanks!
btom
Posts: 4
Joined: Wed Oct 16, 2013 10:17 am

Re: check_mailq plugin issues

Post by btom »

Attached.

This is the 'nagios-plugins-mailq' package in the epel repository. Centos 6.4x64 is the host os that is running nagios, and that i am checking against. Full details from 'yum'

Code: Select all

Name        : nagios-plugins-mailq
Arch        : x86_64
Version     : 1.4.16
Release     : 5.el6
Size        : 20 k
Repo        : installed
From repo   : epel
Summary     : Nagios Plugin - check_mailq
URL         : http://nagiosplug.sourceforge.net/
License     : GPLv2+
Description : Provides check_mailq support for Nagios.
Attachments
check_mailq.txt
/usr/lib64/nagios/plugins/check_mailq
(19.81 KiB) Downloaded 623 times
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mailq plugin issues

Post by slansing »

Interesting, do you have all of your nagios plugins there as well? And you call all of them as you showed in the command definition? The nagios plugins should be installed to:

Code: Select all

/usr/local/nagios/libexec
by default as that is already set up so that the nagios user can run and execute them through apache. One thing we could try doing here is making sure that the nagios user and group can get to, and execute the mailq plugin in:

Code: Select all

/usr/lib64/nagios/plugins

Running:

Code: Select all

chown nagios.nagios /usr/lib64/nagios/plugins
should do the trick.
btom
Posts: 4
Joined: Wed Oct 16, 2013 10:17 am

Re: check_mailq plugin issues

Post by btom »

When i installed this machine instead of compiling by hand, to speed up upgrades and ease maintenance i just used the yum package installer, and so all of the plugins are in the /usr/lib64/nagios/plugins. Most of the hosts that this installation monitors are via remote nrpe connections however locally where we are trying to run the check_mailq we also are successfully using check_load check_users check_disk and check_procs without any isssue. The only difference is that the mailq requires root to be executed from what i can tell.

However we opened the sudoers up for all commands run via the nagios user and so manually there is no problem running the plugin.

I went ahead and applied the user:group changes that you indicated and restarted nagios just in case. I went ahead and forced a service check on the service in question but unfortunately it is still coming back as a warning that the check returned '(null)'

Just as a quick check i went ahead and compiled the whole plugin suite by hand from the nagios plugin site to /usr/local/nagios/libexec

Code: Select all

-bash-4.1$ /usr/bin/sudo /usr/local/nagios/libexec/check_mailq -w 100 -c 200
OK: mailq is empty|unsent=0;100;200;0
as nagios and it runs as i would expect, and returns the same result as the one compiled by yum however on the nagios site still returns warning / 'null' (double checked to make sure i updated the commands.cfg to point to the new plugin)

I am not overly familiar with the nagios debugging capabilities - is there a debug level which i can enable which would show me the command that is run as well as the return of the command?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mailq plugin issues

Post by slansing »

It looks like someone had mad a patch for their mailq check here:

http://sourceforge.net/p/nagiosplug/patches/380/

And the plugin should be packaged with the latest plugins tarball, and it should execute fine without having the explicitly call sudo. Was it not present in the plugins package you downloaded? "The tarball not the yum package."
Locked