Help: nrpe: Unknown option specified in config file
John A. Martin
jam at athene.jamux.com
Tue Apr 5 23:17:17 CEST 2005
>>>>> "Paul" == Paul L Allen
>>>>> "Re: Help: nrpe: Unknown option specified in config file"
>>>>> Tue, 05 Apr 2005 21:10:12 +0100
Paul> John A. Martin writes: Assuming that you cut and paste
Paul> rather than typing it, then check this line very, very
Paul> closely.
>> command{check_mmqage]=/usr/lib/nagios/plugins/check_mmqage.sh
>> -w 300 -c
Paul> See it yet? If not, have another look. And keep looking
Paul> until you see the reason why nrpe was reporting that the
Paul> command check_mmqage was not defined.
Many thanks. I saw the opening brace only after trying to grep for
the whole line! I had been looking for that for several days. It
works now. Time to change type fonts, or get younger eyes.
FWIW below is a cleaner copy of the plugin.
What is the recommended way to implement a timeout in shell?
,----[ /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
;;
*)
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
`----
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/fdc5e44c/attachment.sig>
More information about the Users
mailing list