summaryrefslogtreecommitdiffstats
path: root/Monitoring/plugins/check_temper
diff options
context:
space:
mode:
Diffstat (limited to 'Monitoring/plugins/check_temper')
-rwxr-xr-xMonitoring/plugins/check_temper31
1 files changed, 31 insertions, 0 deletions
diff --git a/Monitoring/plugins/check_temper b/Monitoring/plugins/check_temper
new file mode 100755
index 00000000..dc006307
--- /dev/null
+++ b/Monitoring/plugins/check_temper
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+import sys
+import urllib
+
+if len(sys.argv) < 2 or '-h' in sys.argv:
+ print ("usage: %s URL [high-val field 1] [high field 2] ..." % sys.argv[0])
+ print (" Server reply should look like this: '2011-07-11T09:00 50.0 40.0'")
+ exit(3)
+
+URL=sys.argv[1]
+thresholds=[ float(i) for i in sys.argv[2:]]
+
+ecode=0
+try:
+ ret = urllib.urlopen(URL).read().split()
+ date = ret[0]
+ speeds = [float(i) for i in ret[1:]]
+ if len(speeds) != len(thresholds):
+ raise Exception("Number of speeds != number of given thresholds")
+ for i,speed in enumerate(speeds):
+ if speed > thresholds[i]:
+ print ("Warning: %f°C > %f°C (field %d)!" %(speed,thresholds[i],i))
+ ecode=2
+except Exception,e:
+ print("!! Something aweful happened: "+str(e))
+ exit (1)
+if not ecode:
+ print ("Success: Everything is fine!")
+print ("Info: %s Current speeds: %s" % (date,' '.join([str(i) for i in speeds])))
+exit(ecode)