]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - misc/operations_helpers/munin/tahoe_disktotal
setup: organize misc/ scripts and tools and remove obsolete ones
[tahoe-lafs/tahoe-lafs.git] / misc / operations_helpers / munin / tahoe_disktotal
1 #!/usr/bin/env python
2
3 # This is a munin plugin which pulls data from the server in
4 # misc/operations_helpers/spacetime/diskwatcher.tac . It produces a graph of how much space is
5 # present on all disks across the grid, and how much space is actually being
6 # used. The plugin should be configured with env_url= pointing at the
7 # diskwatcher.tac webport.
8
9 import os, sys, urllib, simplejson
10
11 if len(sys.argv) > 1 and sys.argv[1] == "config":
12     print """\
13 graph_title Tahoe Total Disk Space
14 graph_vlabel bytes
15 graph_category tahoe
16 graph_info This graph shows the total amount of disk space present in the grid, and how much of it is currently being used.
17 disk_total.label disk total
18 disk_total.draw LINE2
19 disk_used.label disk used
20 disk_used.draw LINE1"""
21     sys.exit(0)
22
23 url = os.environ["url"]
24 data = simplejson.load(urllib.urlopen(url))
25 print "disk_total.value", data["total"]
26 print "disk_used.value", data["used"]