summaryrefslogtreecommitdiffstats
path: root/Monitoring/plugins/check_speed
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2011-07-11 19:28:46 +0200
committermakefu <github@syntax-fehler.de>2011-07-11 19:28:46 +0200
commitd4b10109629a2c2120f0b1810380b3a385ac686e (patch)
tree5096b48bbcde3ba8c4783c5d82329a06588a5c27 /Monitoring/plugins/check_speed
parent4775e789f0733559387b9050569e218c58db5139 (diff)
added config for nagios for speed/temp scripts
plugins/*: fixed some usability issues, Warning -> !! , Info -> ** , Stupid -> ?? conf/shack_guests: contains config for miner
Diffstat (limited to 'Monitoring/plugins/check_speed')
-rwxr-xr-xMonitoring/plugins/check_speed24
1 files changed, 13 insertions, 11 deletions
diff --git a/Monitoring/plugins/check_speed b/Monitoring/plugins/check_speed
index 8c2975cd..14a5b612 100755
--- a/Monitoring/plugins/check_speed
+++ b/Monitoring/plugins/check_speed
@@ -1,12 +1,12 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-#TODO check_speed is nearly the same as check_temper, consolidate both scripts, probably by giving HIGH:LOW as params
+#TODO check_speed is nearly the same as check_speeder, consolidate both scripts, probably by giving HIGH:LOW as params
import sys
import urllib
if len(sys.argv) < 2 or '-h' in sys.argv:
- print ("usage: %s URL [low-mhashes] ..." % sys.argv[0])
- print (" Server reply should look like this: '2011-07-11T09:00 400.0'")
+ print ("?? usage: %s URL [low-mhashes] ..." % sys.argv[0])
+ print ("?? Server reply should look like this: '2011-07-11T09:00 400.0'")
exit(3)
URL=sys.argv[1]
@@ -16,17 +16,19 @@ ecode=0
try:
ret = urllib.urlopen(URL).read().split()
date = ret[0]
- temps = [float(i) for i in ret[1:]]
- if len(temps) != len(thresholds):
- raise Exception("Number of temps != number of given thresholds")
- for i,temp in enumerate(temps):
- if temp < thresholds[i]:
- print ("Warning: %.2f Mhash < %.2f Mhash ! (field %d)" %(temp,thresholds[i],i))
+ speeds = [float(i) for i in ret[1:]]
+ print ("** %s : %s Mhashes" % (date,' '.join([str(i) for i in speeds])))
+ 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 ("!! %.2f Mhash < %.2f Mhash ! (field %d)" %(speed,thresholds[i],i))
ecode=2
except Exception,e:
print("!! Something aweful happened: "+str(e))
exit (1)
+#TODO return WARNING if date is too old
if not ecode:
- print ("Success: Everything is fine!")
-print ("Info: %s Current Mhash: %s" % (date,' '.join([str(i) for i in temps])))
+ print ("** Everything is fine!")
+
exit(ecode)