3 # NagCollect -- Nagios Data Collector for Passive Checks
4 # Copyright (c)2009-2012 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!"
32 elif [ -r /usr/local/lib/nagcollect/"$1.tst" ]; then
33 tst=/usr/local/lib/nagcollect/"$1.tst"
34 elif [ -r /usr/local/lib/nagcollect/`uname`/"$1.tst" ]; then
35 tst=/usr/local/lib/nagcollect/`uname`/"$1.tst"
37 echo "$NAME: script \"$1\" not found!"
41 SERVICE=""; STATUS=""; TEXT=""
42 [ -n "$VERBOSE" ] && echo "Checking \"$tst\" ..."
45 if [ "$VERBOSE" ]; then
46 [ -n "$STATUS" -o -n "$TEXT" ] \
47 && echo "RESULT: $SERVICE=$STATUS \"$TEXT\"" \
48 || echo "NO result ..."
52 || echo "$NAME: \"$1\" returned no result?"