3 # NagCollect -- Nagios Data Collector for Passive Checks
4 # Copyright (c)2009-2011 Alexander Barton, alex@barton.de
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 # Please read the file COPYING, README and AUTHORS for more information.
17 if [ "$1" = "-v" ]; then
22 echo "Usage: $NAME [-v] <scriptname>"
25 if [ `id -u` -ne 0 ]; then
26 echo "$NAME must be run as root!"
30 if [ -r /usr/local/lib/nagcollect/"$1.tst" ]; then
31 tst=/usr/local/lib/nagcollect/"$1.tst"
32 elif [ -r /usr/local/lib/nagcollect/`uname`/"$1.tst" ]; then
33 tst=/usr/local/lib/nagcollect/`uname`/"$1.tst"
35 echo "$NAME: script \"$1\" not found!"
39 SERVICE=""; STATUS=""; TEXT=""
40 [ -n "$VERBOSE" ] && echo "Checking \"$tst\" ..."
43 if [ "$VERBOSE" ]; then
44 [ -n "$STATUS" -o -n "$TEXT" ] \
45 && echo "RESULT: $SERVICE=$STATUS \"$TEXT\"" \
46 || echo "NO result ..."
50 || echo "$NAME: \"$1\" returned no result?"