Help: nrpe: Unknown option specified in config file

John A. Martin jam at athene.jamux.com
Tue Apr 5 17:52:31 CEST 2005


I'm having trouble with my self written 'check_mmqage.sh' plugin which
seems to work from the command line.

I'm running nrpe version 2.0 using the Debian packages
nagios-nrpe-server-2.0-7 and nagios-nrpe-plugin-2.0-7.

When I restart the nrpe server I see the following.

,----[ Excerpts from daemon.log with nrpe server debuging on ]
Apr  2 00:14:13 lists nrpe[15930]: Added command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10 
[[ ... ]]
Apr  2 00:14:13 lists nrpe[15930]: Added command[check_mmctl]=/usr/lib/nagios/plugins/check_procs -w 1:1 -c 1:1 -C mailmanctl 
Apr  2 00:14:13 lists nrpe[15930]: Unknown option specified in config file '/etc/nagios/nrpe_local.cfg' - Line 11 
Apr  2 00:14:13 lists nrpe[15930]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
Apr  2 00:14:13 lists nrpe[15931]: Starting up daemon
Apr  2 00:14:13 lists nrpe[15931]: Listening for connections on port 5666 
Apr  2 00:14:13 lists nrpe[15931]: Allowing connections from: 127.0.0.1,65.222.215.34 
[[ ... ]]
Apr  2 00:15:16 lists nrpe[15962]: Connection from 65.222.215.34 port 48800
[[ ... ]]
Apr  2 00:15:16 lists nrpe[15960]: Host is asking for command 'check_mmctl' to be run...
Apr  2 00:15:16 lists nrpe[15960]: Running command: /usr/lib/nagios/plugins/check_procs -w 1:1 -c 1:1 -C mailmanctl
Apr  2 00:15:16 lists nrpe[15960]: Command completed with return code 0 and output: PROCS OK: 1 process with command name 'mailmanctl' 
Apr  2 00:15:16 lists nrpe[15960]: Return Code: 0, Output: PROCS OK: 1 process with command name 'mailmanctl'
Apr  2 00:15:16 lists nrpe[15960]: Connection from 65.222.215.34 closed.
[[ ... ]]
Apr  2 00:16:16 lists nrpe[15974]: Connection from 65.222.215.34 port 52896
Apr  2 00:16:16 lists nrpe[15974]: Host address checks out ok
Apr  2 00:16:16 lists nrpe[15974]: Handling the connection...
Apr  2 00:16:16 lists nrpe[15974]: Host is asking for command 'check_mmqage' to be run...
Apr  2 00:16:16 lists nrpe[15974]: NRPE: Command 'check_mmqage' not defined
Apr  2 00:16:16 lists nrpe[15974]: Return Code: 2, Output: NRPE: Command 'check_mmqage' not defined
Apr  2 00:16:16 lists nrpe[15974]: Connection from 65.222.215.34 closed.
`----

,----[ head -11 /etc/nagios/nrpe_local.cfg|tail -2 ]
command[check_mmctl]=/usr/lib/nagios/plugins/check_procs -w 1:1 -c 1:1 -C mailmanctl
command{check_mmqage]=/usr/lib/nagios/plugins/check_mmqage.sh -w 300 -c 600 -d /var/lib/mailman/qfiles
`----

,----[ cat /etc/nagios-plugins/config/mailman.cfg ]
# 'check_mmqage' command definition
define command{
        command_name    check_mmqage
        command_line    /usr/lib/nagios/plugins/check_mmqage.sh -w $ARG1$ -c $ARG2$ -d $ARG3$
        }
`----

On the nrpe client:

,----[ grep -A 1 -B 1 mmqage /etc/nagios/checkcommands.cfg ]
define command{
        command_name    nrpe-check_mmqage
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c check_mmqage
        }
`----

On the nrpe server:

,----[ cat /usr/lib/nagios/plugins/check_mmqage.sh ]
#!/bin/sh

# Finds the age of the oldest Mailman queue file
# Intended for Mailman 2.1.x
# This nagios plugin come with ABSOLUTELY NO WARRANTY. You may redistribute
# copies of the plugins under the terms of the GNU General Public License.
# "Copyright (c) 2005 John A. Martin"

# check_mmqfiles [-w <secs>] [-c <secs>] -t <timeoutsecs> -d <directory>

set -e

PATH=""

STAT="/usr/bin/stat"
DATE="/bin/date"

PROGNAME=`/usr/bin/basename $0`
PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 0.0.1 $' | /bin/sed -e 's/[^0-9.]//g'`

#. $PROGPATH/utils.sh
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4

if test -x /usr/bin/printf; then
        ECHO=/usr/bin/printf
else
        ECHO=echo
fi

print_revision() {
        echo "$1 (nagios-plugins 1.4) $2"
        $ECHO "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\n" | /bin/sed -e 's/\n/ /g'
}

support() {
        $ECHO "This plugin can be used with Nagios but is not part of Nagios and is not\ndistributed with Nagios.  This plugin has not been distributed to the public.\nIf you received this plugin directly from me and you have questions or\nsuggestions please mail me at <jam at jamux.com>.  Please include version\ninformation with all correspondence (when possible, use output from the\n--version option of the plugin itself).\n" | /bin/sed -e 's/\n/ /g'
}
# END wattered down boilerplate fron Nagios utils.sh

print_usage() {
echo "Usage:"
echo "  $PROGNAME  [-w <secs>] [-c <secs>] [-t <timeoutsecs>] -d <directory>"
echo "  $PROGNAME -h | --help"
echo "  $PROGNAME -v | --version"
echo
echo "  <secs> Age of the oldest queue file must not exceed this many seconds"
echo "  <tmeoutsecs> check_mmqfiles will abort after this many seconds"
echo "  <directory> the directory containing only sub-directories containing"
echo "    only queue files.  For Mailman 2.1.5 on Debian this is"
echo "    /var/lib/mailman/qfiles containing several subdirectories where"
echo "    the actual queue files live."
}

print_help() {
    print_revision $PROGNAME $REVISION
    echo ""
    print_usage
    echo ""
    echo "Mailman qfile age examiner plugin for Nagios"
    echo ""
    support
}

#defaults
warn=9999999999
crit=9999999999
timeout=10
topd=""

if [ $# -lt 1 ]; then
    print_usage
    exit $STATE_UNKNOWN
fi

while test -n "$1"; do
    case "$1" in
        -d)
            topd=$2
            shift
            ;;
        -w)
            warn=$2
            shift
            ;;
        -c)
            crit=$2
            shift
            ;;
        -t)
            timeout=$2
            shift
            ;;
        --help)
            print_help
            exit $STATE_OK
            ;;
        -h)
            print_help
            exit $STATE_OK
            ;;
        --version)
            print_revision $PROGNAME $VERSION
            exit $STATE_OK
            ;;
        -V)
            print_revision $PROGNAME $VERSION
            exit $STATE_OK
            ;;
        --filename)
            logfile=$2
            shift
            ;;
        *)
            echo "Unknown argument: $1"
            print_usage
            exit $STATE_UNKNOWN
            ;;
    esac
    shift
done

if [ ! -d $topd ]; then
    $ECHO "Directory check error: Directory $topd does not exist!\n"
    exit $STATE_UNKNOWN
elif [ ! -r $topd ] ; then
    $ECHO "Directory check error: Directory $topd is not readable!\n"
    exit $STATE_UNKNOWN
fi

subdir=""
declare -i count=0 old=9999999999 mtime

for d in $topd/*; do
    if [ -d $d ]; then
        for f in $d/*; do
            if [ -f $f ]; then
                mtime=$($STAT -c %Y $f)
                ((count++))
                if [ $old -gt $mtime ]; then
                    old=$mtime
                    subdir=$d
                fi
            fi
        done
    fi
done

if [ $count -eq 0 ]; then
    $ECHO "OK - 0 queue files in $topd\n"
    exit $STATE_OK
fi

now=$($DATE +%s)
age=$((now-old))
queuename=${subdir##*/}
explain="- $count queue files, oldest $age secs old in the '$queuename' queue"

if [ $age -le $warn ]; then $ECHO "OK $explain\n"; exit $STATE_OK; fi
if [ $age -le $crit ]; then $ECHO "WARNING $explain\n"; exit $STATE_WARNING; fi
$ECHO "CRITICAL $explain\n"; exit $STATE_CRITICAL;
exit $STATE_UNKNOWN
`----

Now, can you point me to what I am missing or to what I am doing
wrong?

        jam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 154 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050405/356cb78f/attachment.sig>


More information about the Users mailing list