2008-11-18 00:51:01 -07:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
# 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 space is
|
2008-11-18 15:44:31 -07:00
|
|
|
# present on all disks across the grid, and how much space is actually being
|
|
|
|
# used. The plugin should be configured with env_url= pointing at the
|
|
|
|
# diskwatcher.tac webport.
|
2008-11-18 00:51:01 -07:00
|
|
|
|
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-11-18 00:51:01 -07:00
|
|
|
|
|
|
|
if len(sys.argv) > 1 and sys.argv[1] == "config":
|
2019-03-22 11:40:58 +01:00
|
|
|
print("""\
|
2008-11-18 00:51:01 -07:00
|
|
|
graph_title Tahoe Total Disk Space
|
|
|
|
graph_vlabel bytes
|
|
|
|
graph_category tahoe
|
2008-11-18 15:44:31 -07:00
|
|
|
graph_info This graph shows the total amount of disk space present in the grid, and how much of it is currently being used.
|
2008-11-18 00:51:01 -07:00
|
|
|
disk_total.label disk total
|
2008-11-18 15:44:31 -07:00
|
|
|
disk_total.draw LINE2
|
|
|
|
disk_used.label disk used
|
2019-03-22 11:40:58 +01:00
|
|
|
disk_used.draw LINE1""")
|
2008-11-18 00:51:01 -07:00
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
url = os.environ["url"]
|
2017-01-19 15:39:53 -07:00
|
|
|
data = json.load(urllib.urlopen(url))
|
2019-03-22 11:40:58 +01:00
|
|
|
print("disk_total.value", data["total"])
|
|
|
|
print("disk_used.value", data["used"])
|