diff options
Diffstat (limited to 'Monitoring')
-rw-r--r-- | Monitoring/conf/hostgroups_nagios2.cfg | 31 | ||||
-rw-r--r-- | Monitoring/conf/shack_guests.cfg | 35 | ||||
-rwxr-xr-x | Monitoring/plugins/check_speed | 24 | ||||
-rwxr-xr-x | Monitoring/plugins/check_temper | 22 |
4 files changed, 85 insertions, 27 deletions
diff --git a/Monitoring/conf/hostgroups_nagios2.cfg b/Monitoring/conf/hostgroups_nagios2.cfg new file mode 100644 index 00000000..63acbf50 --- /dev/null +++ b/Monitoring/conf/hostgroups_nagios2.cfg @@ -0,0 +1,31 @@ +# Some generic hostgroup definitions + +# A simple wildcard hostgroup +define hostgroup { + hostgroup_name all + alias All Servers + members * + } + +# A list of your Debian GNU/Linux servers +define hostgroup { + hostgroup_name debian-servers + alias Debian GNU/Linux Servers + members localhost + } + +# A list of your web servers +define hostgroup { + hostgroup_name http-servers + alias HTTP servers + members localhost + } + +# A list of your ssh-accessible servers +define hostgroup { + hostgroup_name ssh-servers + alias SSH servers + members localhost + } + + diff --git a/Monitoring/conf/shack_guests.cfg b/Monitoring/conf/shack_guests.cfg index faf9f833..7a8cc088 100644 --- a/Monitoring/conf/shack_guests.cfg +++ b/Monitoring/conf/shack_guests.cfg @@ -34,21 +34,46 @@ define host{ alias Chinaman Bitcoin Mining Rig address 10.42.0.96 _TINC_ADDRESS 10.7.7.6 + _SPEED_URL http://leechi.kicks-ass.org/tmp/live/chinaman_bitcoinslc_live + _TEMPER_URL http://leechi.kicks-ass.org/tmp/live/chinaman_bitcoinslc_live hostgroups bitcoin-miner,tinc-nodes,ssh-servers contact_groups krebsminers } +define command { + command_name check_speed + command_line $USER1$/check_speed $_HOSTSPEED_URL$ $ARG1$ + } define service { host_name chinaman - service_description BTCGUILD hash rate checker + service_description Temperature Checker use generic-service - check_command check_btcguild_miner!4bf1543d2eca8648277bdc66c326eea9!txgen_chinaman!450 + check_command check_temper!85 85 65 45 contact_groups krebsminers } - define command { - command_name check_btcguild_miner - command_line $USER1$/check_btcguild_miner $ARG1$ $ARG2$ $ARG3$ + command_name check_temper + command_line $USER1$/check_speed $_HOSTTEMPER_URL$ $ARG1$ + } +define service { + host_name chinaman + service_description Mining Speed checker + use generic-service + check_command check_speed!600 + contact_groups krebsminers } +#define service { +# host_name chinaman +# service_description BTCGUILD hash rate checker +# use generic-service +# check_command check_btcguild_miner!4bf1543d2eca8648277bdc66c326eea9!txgen_chinaman!450 +# contact_groups krebsminers +# } + + +#define command { +# command_name check_btcguild_miner +# command_line $USER1$/check_btcguild_miner $ARG1$ $ARG2$ $ARG3$ +# } define host{ use generic-host 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) 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) |