]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - misc/operations_helpers/munin/tahoe_introstats
setup: organize misc/ scripts and tools and remove obsolete ones
[tahoe-lafs/tahoe-lafs.git] / misc / operations_helpers / munin / tahoe_introstats
1 #!/usr/bin/env python
2
3 import os, sys
4 import urllib
5 import simplejson
6
7 configinfo = """\
8 graph_title Tahoe Introducer Stats
9 graph_vlabel hosts
10 graph_category tahoe
11 graph_info This graph shows the number of hosts announcing and subscribing to various services
12 storage_server.label Storage Servers
13 storage_server.draw LINE1
14 storage_hosts.label Distinct Storage Hosts
15 storage_hosts.draw LINE1
16 storage_client.label Clients
17 storage_client.draw LINE2
18 """
19
20 if len(sys.argv) > 1:
21     if sys.argv[1] == "config":
22         print configinfo.rstrip()
23         sys.exit(0)
24
25 url = os.environ["url"]
26
27 data = simplejson.loads(urllib.urlopen(url).read())
28 print "storage_server.value %d" % data["announcement_summary"]["storage"]
29 print "storage_hosts.value %d" % data["announcement_distinct_hosts"]["storage"]
30 print "storage_client.value %d" % data["subscription_summary"]["storage"]
31