| Line | |
|---|
| 1 | #!/usr/bin/env python |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | import os, sys |
|---|
| 5 | import urllib |
|---|
| 6 | import json |
|---|
| 7 | |
|---|
| 8 | configinfo = """\ |
|---|
| 9 | graph_title Tahoe Introducer Stats |
|---|
| 10 | graph_vlabel hosts |
|---|
| 11 | graph_category tahoe |
|---|
| 12 | graph_info This graph shows the number of hosts announcing and subscribing to various services |
|---|
| 13 | storage_server.label Storage Servers |
|---|
| 14 | storage_server.draw LINE1 |
|---|
| 15 | storage_hosts.label Distinct Storage Hosts |
|---|
| 16 | storage_hosts.draw LINE1 |
|---|
| 17 | storage_client.label Clients |
|---|
| 18 | storage_client.draw LINE2 |
|---|
| 19 | """ |
|---|
| 20 | |
|---|
| 21 | if len(sys.argv) > 1: |
|---|
| 22 | if sys.argv[1] == "config": |
|---|
| 23 | print(configinfo.rstrip()) |
|---|
| 24 | sys.exit(0) |
|---|
| 25 | |
|---|
| 26 | url = os.environ["url"] |
|---|
| 27 | |
|---|
| 28 | data = json.loads(urllib.urlopen(url).read()) |
|---|
| 29 | print("storage_server.value %d" % data["announcement_summary"]["storage"]) |
|---|
| 30 | print("storage_hosts.value %d" % data["announcement_distinct_hosts"]["storage"]) |
|---|
| 31 | print("storage_client.value %d" % data["subscription_summary"]["storage"]) |
|---|
| 32 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.