]> arthur.barton.de Git - nagcollect.git/blobdiff - client/lib/tests/Sys-Load.tst
Move client-side test scripts to client/lib/tests
[nagcollect.git] / client / lib / tests / Sys-Load.tst
diff --git a/client/lib/tests/Sys-Load.tst b/client/lib/tests/Sys-Load.tst
new file mode 100644 (file)
index 0000000..c731f4b
--- /dev/null
@@ -0,0 +1,22 @@
+# NagCollect -- Nagios Data Collector for Passive Checks
+# Copyright (c)2009 Alexander Barton, alex@barton.de
+
+SERVICE="Sys-Load_p"
+
+uptime=`LC_ALL=C uptime`
+load=${uptime##*:}
+
+load01=`echo $load | cut -d' ' -f1 | cut -d'.' -f1`
+load05=`echo $load | cut -d' ' -f2 | cut -d'.' -f1`
+load15=`echo $load | cut -d' ' -f3 | cut -d'.' -f1`
+
+if [ $load01 -ge 8 -o $load05 -ge 6 -o $load15 -ge 3 ]; then
+       STATUS=2
+       TEXT="ERROR - Load average: $load"
+elif [ $load01 -ge 4 -o $load05 -ge 3 -o $load15 -ge 1 ]; then
+       STATUS=1
+       TEXT="WARNING - Load average: $load"
+else
+       STATUS=0
+       TEXT="OK - Load average: $load"
+fi
\ No newline at end of file