2008-11-05 01:03:06 +00:00
|
|
|
#!/usr/bin/env python
|
2008-03-25 20:15:52 +00:00
|
|
|
|
2019-03-22 10:40:58 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2008-03-25 20:15:52 +00:00
|
|
|
import os, sys
|
|
|
|
import urllib
|
2017-01-19 22:39:53 +00:00
|
|
|
import json
|
2008-03-25 20:15:52 +00:00
|
|
|
|
|
|
|
configinfo = """\
|
|
|
|
graph_title Tahoe Introducer Stats
|
|
|
|
graph_vlabel hosts
|
2008-03-28 21:51:37 +00:00
|
|
|
graph_category tahoe
|
2008-03-25 20:15:52 +00:00
|
|
|
graph_info This graph shows the number of hosts announcing and subscribing to various services
|
|
|
|
storage_server.label Storage Servers
|
|
|
|
storage_server.draw LINE1
|
2008-11-18 22:32:38 +00:00
|
|
|
storage_hosts.label Distinct Storage Hosts
|
|
|
|
storage_hosts.draw LINE1
|
2008-03-25 20:15:52 +00:00
|
|
|
storage_client.label Clients
|
|
|
|
storage_client.draw LINE2
|
|
|
|
"""
|
|
|
|
|
|
|
|
if len(sys.argv) > 1:
|
|
|
|
if sys.argv[1] == "config":
|
2019-03-22 10:40:58 +00:00
|
|
|
print(configinfo.rstrip())
|
2008-03-25 20:15:52 +00:00
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
url = os.environ["url"]
|
|
|
|
|
2017-01-19 22:39:53 +00:00
|
|
|
data = json.loads(urllib.urlopen(url).read())
|
2019-03-22 10:40:58 +00:00
|
|
|
print("storage_server.value %d" % data["announcement_summary"]["storage"])
|
|
|
|
print("storage_hosts.value %d" % data["announcement_distinct_hosts"]["storage"])
|
|
|
|
print("storage_client.value %d" % data["subscription_summary"]["storage"])
|
2008-03-25 20:15:52 +00:00
|
|
|
|