2008-11-05 01:03:06 +00:00
|
|
|
#!/usr/bin/env python
|
2008-08-28 20:32:36 +00:00
|
|
|
|
|
|
|
# This is a munin plugin which pulls data from the server in
|
2010-06-07 05:16:18 +00:00
|
|
|
# misc/operations_helpers/spacetime/diskwatcher.tac . It produces a graph of how much free space
|
2008-08-28 20:32:36 +00:00
|
|
|
# is left on all disks across the grid. The plugin should be configured with
|
|
|
|
# env_url= pointing at the diskwatcher.tac webport.
|
|
|
|
|
2019-03-22 10:40:58 +00:00
|
|
|
|
2017-01-19 22:39:53 +00:00
|
|
|
import os, sys, urllib, json
|
2008-08-28 20:32:36 +00:00
|
|
|
|
|
|
|
if len(sys.argv) > 1 and sys.argv[1] == "config":
|
2019-03-22 10:40:58 +00:00
|
|
|
print("""\
|
2008-08-28 20:32:36 +00:00
|
|
|
graph_title Tahoe Remaining Disk Space
|
|
|
|
graph_vlabel bytes remaining
|
|
|
|
graph_category tahoe
|
|
|
|
graph_info This graph shows the total amount of disk space left available in the grid
|
|
|
|
disk_left.label disk left
|
2019-03-22 10:40:58 +00:00
|
|
|
disk_left.draw LINE1""")
|
2008-08-28 20:32:36 +00:00
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
url = os.environ["url"]
|
2017-01-19 22:39:53 +00:00
|
|
|
data = json.load(urllib.urlopen(url))["available"]
|
2019-03-22 10:40:58 +00:00
|
|
|
print("disk_left.value", data)
|