tahoe-lafs/misc/operations_helpers/munin/tahoe_introstats

34 lines
896 B
Plaintext
Raw Normal View History

#!/usr/bin/env python
from __future__ import print_function
import os, sys
import urllib
2017-01-19 22:39:53 +00:00
import json
configinfo = """\
graph_title Tahoe Introducer Stats
graph_vlabel hosts
graph_category tahoe
graph_info This graph shows the number of hosts announcing and subscribing to various services
storage_server.label Storage Servers
storage_server.draw LINE1
storage_hosts.label Distinct Storage Hosts
storage_hosts.draw LINE1
storage_client.label Clients
storage_client.draw LINE2
"""
if len(sys.argv) > 1:
if sys.argv[1] == "config":
print(configinfo.rstrip())
sys.exit(0)
url = os.environ["url"]
2017-01-19 22:39:53 +00:00
data = json.loads(urllib.urlopen(url).read())
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"])