diff options
author | makefu <github@syntax-fehler.de> | 2011-07-11 19:28:46 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2011-07-11 19:28:46 +0200 |
commit | 3ae1ad0a6739d1841926bba48c3a61a9f8957ff4 (patch) | |
tree | ea96304a49aa5742298614b1013d7a999928f57d /Monitoring/plugins/check_temper | |
parent | f1a50c9f15e23df2f367123c32a26a8c725f5cc7 (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_temper')
-rwxr-xr-x | Monitoring/plugins/check_temper | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Monitoring/plugins/check_temper b/Monitoring/plugins/check_temper index dc006307..f2e0fd32 100755 --- a/Monitoring/plugins/check_temper +++ b/Monitoring/plugins/check_temper @@ -4,8 +4,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'") + 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] @@ -15,17 +15,17 @@ 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)) + temps = [float(i) for i in ret[1:]] + print ("** %s : %s" % (date,' '.join([str(i)+"°C" for i in temps]))) + 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 ("!! %.2f°C > %.2f°C (field %d)!" %(temp,thresholds[i],i)) ecode=2 except Exception,e: - print("!! Something aweful happened: "+str(e)) + print("!! Something awful 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]))) + print ("** Everything is fine!") exit(ecode) |