2008-11-04 18:03:06 -07:00
|
|
|
#!/usr/bin/env python
|
2008-08-28 13:32:36 -07:00
|
|
|
|
|
|
|
# This is a munin plugin which pulls data from the server in
|
2010-06-06 22:16:18 -07:00
|
|
|
# misc/operations_helpers/spacetime/diskwatcher.tac . It produces a graph of how much free space
|
2008-08-28 13:32:36 -07: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 11:40:58 +01:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2017-01-19 15:39:53 -07:00
|
|
|
import os, sys, urllib, json
|
2008-08-28 13:32:36 -07:00
|
|
|
|
|
|
|
if len(sys.argv) > 1 and sys.argv[1] == "config":
|
2019-03-22 11:40:58 +01:00
|
|
|
print("""\
|
2008-08-28 13:32:36 -07: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 11:40:58 +01:00
|
|
|
disk_left.draw LINE1""")
|
2008-08-28 13:32:36 -07:00
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
url = os.environ["url"]
|
2017-01-19 15:39:53 -07:00
|
|
|
data = json.load(urllib.urlopen(url))["available"]
|
2019-03-22 11:40:58 +01:00
|
|
|
print("disk_left.value", data)
|