Add "nagcollecttest" script
authorAlexander Barton <alex@barton.de>
Tue, 15 Nov 2011 10:59:22 +0000 (11:59 +0100)
committerAlexander Barton <alex@barton.de>
Tue, 15 Nov 2011 10:59:22 +0000 (11:59 +0100)
client/bin/nagcollecttest [new file with mode: 0755]

diff --git a/client/bin/nagcollecttest b/client/bin/nagcollecttest
new file mode 100755 (executable)
index 0000000..e31644f
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# NagCollect -- Nagios Data Collector for Passive Checks
+# Copyright (c)2009-2011 Alexander Barton, alex@barton.de
+#
+# 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 2 of the License, or
+# (at your option) any later version.
+# Please read the file COPYING, README and AUTHORS for more information.
+#
+
+NAME=`basename "$0"`
+MAXTIME=300
+
+if [ $# -ne 1 ]; then
+       echo "Usage: $NAME <scriptname>"
+       exit 2
+fi
+if [ `id -u` -ne 0 ]; then
+       echo "$NAME must be run as root!"
+       exit 2
+fi
+
+if [ -r /usr/local/lib/nagcollect/"$1.tst" ]; then
+       tst=/usr/local/lib/nagcollect/"$1.tst"
+elif [ -r /usr/local/lib/nagcollect/`uname`/"$1.tst" ]; then
+       tst=/usr/local/lib/nagcollect/`uname`/"$1.tst"
+else
+       echo "$NAME: script \"$1\" not found!"
+       exit 2
+fi
+
+SERVICE=""; STATUS=""; TEXT=""
+echo "Checking \"$tst\" ..."
+. "$tst"
+echo "RESULT: $SERVICE=$STATUS \"$TEXT\""
+
+# -eof-