Skip to content

Commit

Permalink
clean up the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
makefu committed Jun 1, 2015
1 parent 70acd0c commit e7a8eca
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 15 deletions.
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,55 @@ The scripts are working with the radioactiveathome.org api.
Forum Post: http://radioactiveathome.org/boinc/forum_thread.php?id=60
Exporter: http://radioactiveathome.org/boinc/gettrickledata.php?start=X&hostid=Y

## current_geiger.sh
# check_geiger

nagios script to check geiger uSV data:

usage: rah-check-geiger [options]

Options:
-w --warning <uSv> Warning level in uSv [default: 0.3]
-c --critical <uSv> Critical level in uSv [default: 0.8]
-h --hostid <id> Host Identity in radioactiveathome [default: 14364]
-u --url <URL> radioactivehome trickledata [default: http://radioactiveathome.org/boinc/gettrickledata.php]


$ python rah-check-geiger
radiation OK at 0.106uSv/h - below 0.3uSv/h
<- exit code 0
$ python rah-check-geiger -w 0.01
radiation WARNING at 0.106uSv/h - above 0.01uSv/h
<- exit code 1
$ python rah-check-geiger -c 0.01
radiation CRITICAL at 0.106uSv/h - above 0.01uSv/h
<- exit code 2


# check_geiger_last_data

nagios script to check geiger trickledata last entry

usage: check_geiger_last_data [options]

Options:
-w --warning <hours> Warning threshold for hours since last data entry [default: 24]
-c --critical <hours> Warning threshold for hours since last data entry [default: 72]
-h --hostid <id> Host Identity in radioactiveathome [default: 14364]
-u --url <URL> radioactivehome trickledata [default: http://radioactiveathome.org/boinc/gettrickledata.php]


$ python rah-check-geiger-last-data
radiation timeout OK - last data 126 minutes ago
<- exit code 0
$ python rah-check-geiger-last-data -w 1
radiation timeout WARNING - no data since 2 hours
<- exit code 1
$ python rah-check-geiger-last-data -c 1
radiation timeout CRITICAL - no data since 2 hours
<- exit code 2

## legacy/current_geiger.sh
returns the uSV value of the last data point

## last_data.sh
## legacy/last_data.sh
returns the seconds since the last data entry
2 changes: 2 additions & 0 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docopt==0.6.2
requests==2.7.0
8 changes: 5 additions & 3 deletions check_geiger → rah-check-geiger
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python
""" usage: check_geiger [options]
""" RadioactiveAtHome check geiger uSv Nagios Plugin
usage: rah-check-geiger [options]
Options:
-w --warning <uSv> Warning level in uSv [default: 0.3]
Expand All @@ -15,8 +17,8 @@ import requests,csv,sys

if __name__ == "__main__":
args = docopt(__doc__)
warn = args['--warning']
crit = args['--critical']
warn = float(args['--warning'])
crit = float(args['--critical'])
hostid = args['--hostid']
url = args['--url']
payload = {'hostid':hostid}
Expand Down
13 changes: 3 additions & 10 deletions check_geiger_last_data → rah-check-geiger-last-data
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
#!/usr/bin/env python
""" usage: check_geiger [options]
""" RadioactiveAtHome Check last Geiger Data Nagios Plugin
usage: rah-check-geiger-last-data [options]
Options:
-w --warning <hours> Warning threshold for hours since last data entry [default: 24]
-c --critical <hours> Warning threshold for hours since last data entry [default: 72]
-h --hostid <id> Host Identity in radioactiveathome [default: 14364]
-u --url <URL> radioactivehome trickledata [default: http://radioactiveathome.org/boinc/gettrickledata.php]
first=$(curl -s http://radioactiveathome.org/boinc/gettrickledata.php?hostid=14364| head -n 1 | cut -d: -f 2 )
last_date=$(curl -s "http://radioactiveathome.org/boinc/gettrickledata.php?hostid=14364&start=$(($first-1))" \
| tail -n 1 | cut -d, -f4)
date_ts=$(date -d"$last_date" +%s )
date_now=$(date +%s)
echo "Seconds since last data:" $(($date_now - $date_ts))
if test $(($date_now - $date_ts < 60*60*24)) -eq '0' ;then
"""


Expand Down

0 comments on commit e7a8eca

Please sign in to comment.