]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - misc/munin/tahoe-helperstats-fetched.py
9dcbea5d71e6d2da2b3f1abca457e9e77826cf7e
[tahoe-lafs/tahoe-lafs.git] / misc / munin / tahoe-helperstats-fetched.py
1 #! /usr/bin/python
2
3 import os, sys
4 import urllib
5 import simplejson
6
7 configinfo = """\
8 graph_title Tahoe Helper Stats - Bytes Fetched
9 graph_vlabel bytes
10 graph_category tahoe
11 graph_info This graph shows the amount of data being fetched by the helper
12 fetched.label Bytes Fetched
13 fetched.type GAUGE
14 fetched.draw LINE1
15 fetched.min 0
16 """
17
18 if len(sys.argv) > 1:
19     if sys.argv[1] == "config":
20         print configinfo.rstrip()
21         sys.exit(0)
22
23 url = os.environ["url"]
24
25 data = simplejson.loads(urllib.urlopen(url).read())
26 print "fetched.value %d" % data["CHK_fetched_bytes"]