getting problem with eximailqueue

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.
rlinux57
Posts: 324
Joined: Mon Dec 08, 2014 12:03 am

getting problem with eximailqueue

Post by rlinux57 »

When i have run below command the output shows messages on mail queue. It will not shown the numbers.
/usr/lib64/nagios/plugins/check_nrpe -H IP Adress -c check_eximailqueue
[Output]
Mailqueue WARNING - messages on queue
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: getting problem with eximailqueue

Post by slansing »

Can you attach the plugin? Have you checked it's usage to see if it even outputs what you are looking for?
rlinux57
Posts: 324
Joined: Mon Dec 08, 2014 12:03 am

Re: getting problem with eximailqueue

Post by rlinux57 »

I have added below text in visudo:

Defaults:nagios !requiretty
#nagios ALL= NOPASSWD:/usr/sbin/exim
%nagios ALL=(ALL) NOPASSWD: ALL
#nagios ALL=(ALL) NOPASSWD: /usr/local/nagios/libexec/
nagios ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/
rlinux57
Posts: 324
Joined: Mon Dec 08, 2014 12:03 am

Re: getting problem with eximailqueue

Post by rlinux57 »

Kindly check the below text of eximailqueue:


#!/bin/sh
###############################################
#
# Nagios script to check Exim mail queue status
#
# Copyright 2007, 2008 Ian Yates
#
# NOTE: Depending on your config, the nagios user will probably be
# needed to be added to the exim group for this script to function correctly
#
# See usage for command line switches
#
# You need to add the following to /etc/sudoers:
# nagios ALL=NOPASSWD:/usr/local/exim/bin/exim
#
# Created: 2006-07-31 (i.yates@uea.ac.uk)
# Updated: 2007-04-30 (i.yates@uea.ac.uk) - Linux/sudo tweaks
# Updated: 2008-03-26 (i.yates@uea.ac.uk) - Fixed bug in critical/warning level checking which could result in erroneous results.
# Updated: 2008-11-27 (i.yates@uea.ac.uk) - Added GPLv3 licence
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################

. /usr/local/nagios/libexec/utils.sh


VERSION="1.3"

#EXIM=/usr/sbin/exim
#SUDO=/usr/bin/sudo

FLAG_VERBOSE=FALSE
LEVEL_WARN=""
LEVEL_CRIT=""
RESULT=""
EXIT_STATUS=$STATE_OK


###############################################
#
## FUNCTIONS
#

## Print usage
usage() {
echo " check_eximailqueue $VERSION - Nagios Exim mail queue check script"
echo ""
echo " Usage: check_eximailqueue -w <warning queue size> -c <critical queue size> [ -v ] [ -h ]"
echo ""
echo " -w Queue size at which a warning is triggered"
echo " -c Queue size at which a critical is triggered"
echo " -v Verbose output (ignored for now)"
echo " -h Show this page"
echo ""
}

## Process command line options
doopts() {
if ( `test 0 -lt $#` )
then
while getopts w:c:vh myarg "$@"
do
case $myarg in
h|\?)
usage
exit;;
w)
LEVEL_WARN=$OPTARG;;
c)
LEVEL_CRIT=$OPTARG;;
v)
FLAG_VERBOSE=TRUE;;
*) # Default
usage
exit;;
esac
done
else
usage
exit
fi
}


# Write output and return result
theend() {
echo $RESULT
exit $EXIT_STATUS
}


#
## END FUNCTIONS
#

#############################################
#
## MAIN
#


# Handle command line options
doopts $@

# Do the do
#OUTPUT=`$SUDO -u root $EXIM -bpc`
OUTPUT=`/usr/bin/sudo /usr/sbin/exim -bpc`

if test -z "$OUTPUT" ; then
RESULT="Mailqueue WARNING - $OUTPUT messages on queue"
EXIT_STATUS=$STATE_WARNING
else
if test "$OUTPUT" -lt "$LEVEL_WARN" ; then
RESULT="Mailqueue OK - $OUTPUT messages on queue"
EXIT_STATUS=$STATE_OK
else
if test "$OUTPUT" -ge "$LEVEL_CRIT" ; then
RESULT="Mailqueue CRITICAL - $OUTPUT messages on queue"
EXIT_STATUS=$STATE_CRITICAL
else
if test "$OUTPUT" -ge "$LEVEL_WARN" ; then
RESULT="Mailqueue WARNING - $OUTPUT messages on queue"
EXIT_STATUS=$STATE_WARNING
fi
fi
fi
fi

# Quit and return information and exit status
theend
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: getting problem with eximailqueue

Post by slansing »

Have you tried passing it a warning or critical value yet? Or using the verbose flag? I unfortunately have no idea what the output from:

Code: Select all

/usr/bin/sudo /usr/sbin/exim -bpc
would be.
rlinux57
Posts: 324
Joined: Mon Dec 08, 2014 12:03 am

Re: getting problem with eximailqueue

Post by rlinux57 »

When ever i run this command manually or define command, the output does'nt show the number of messages :
/usr/lib64/nagios/plugins/check_nrpe -H IP ADDRESS -c check_eximailqueue

[Output]
Mailqueue WARNING - messages on queue


But when i run on host :
/usr/lib64/nagios/plugins/check_eximailqueue -w 25 -c 29
Mailqueue OK - 0 messages on queue
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: getting problem with eximailqueue

Post by slansing »

Hmm, it probably doesn't have handing built in to just give you the straight number. You would want to be defining warning and critical values anyways correct? As you will be checking it? What happens if you queue a message and run the check? Does it pick it up when using -w and -c?
rlinux57
Posts: 324
Joined: Mon Dec 08, 2014 12:03 am

Re: getting problem with eximailqueue

Post by rlinux57 »

Here's the output with -w and -c at nagios monitoring server.
/usr/lib64/nagios/plugins/check_nrpe -H IP ADDRESS -c check_eximailqueue -a '-w 25 -c 100'
[Output]
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: getting problem with eximailqueue

Post by scottwilkerson »

cang you share your nrpe.cfg from the client machie so we can see the command defined for check_eximailqueue

thanks
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
rlinux57
Posts: 324
Joined: Mon Dec 08, 2014 12:03 am

Re: getting problem with eximailqueue

Post by rlinux57 »

Below are the nrpe.cfg commands:


# The following examples use hardcoded command arguments...

command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200


# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'. This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

#command[check_users]=/usr/lib64/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/lib64/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
#command[check_home-disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/md2
command[check_eximailqueue]=/usr/lib64/nagios/plugins/check_eximailqueue -w 25 -c 100
command[check_root-disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/mapper/vg_vps-lv_root
Locked