2008-11-05 01:03:06 +00:00
|
|
|
#!/usr/bin/env python
|
2008-03-27 23:46:08 +00:00
|
|
|
|
|
|
|
import os, sys
|
|
|
|
import urllib
|
|
|
|
import simplejson
|
|
|
|
|
|
|
|
configinfo = """\
|
|
|
|
graph_title Tahoe Helper Stats - Bytes Fetched
|
|
|
|
graph_vlabel bytes
|
2008-03-28 23:18:30 +00:00
|
|
|
graph_category tahoe
|
2008-03-27 23:46:08 +00:00
|
|
|
graph_info This graph shows the amount of data being fetched by the helper
|
|
|
|
fetched.label Bytes Fetched
|
|
|
|
fetched.type GAUGE
|
|
|
|
fetched.draw LINE1
|
|
|
|
fetched.min 0
|
|
|
|
"""
|
|
|
|
|
|
|
|
if len(sys.argv) > 1:
|
|
|
|
if sys.argv[1] == "config":
|
|
|
|
print configinfo.rstrip()
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
url = os.environ["url"]
|
|
|
|
|
|
|
|
data = simplejson.loads(urllib.urlopen(url).read())
|
2008-04-14 20:18:53 +00:00
|
|
|
print "fetched.value %d" % data["chk_upload_helper.fetched_bytes"]
|