| 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 Helper Stats - Bytes Fetched |
|---|
| 10 | graph_vlabel bytes |
|---|
| 11 | graph_category tahoe |
|---|
| 12 | graph_info This graph shows the amount of data being fetched by the helper |
|---|
| 13 | fetched.label Bytes Fetched |
|---|
| 14 | fetched.type GAUGE |
|---|
| 15 | fetched.draw LINE1 |
|---|
| 16 | fetched.min 0 |
|---|
| 17 | """ |
|---|
| 18 | |
|---|
| 19 | if len(sys.argv) > 1: |
|---|
| 20 | if sys.argv[1] == "config": |
|---|
| 21 | print(configinfo.rstrip()) |
|---|
| 22 | sys.exit(0) |
|---|
| 23 | |
|---|
| 24 | url = os.environ["url"] |
|---|
| 25 | |
|---|
| 26 | data = json.loads(urllib.urlopen(url).read()) |
|---|
| 27 | print("fetched.value %d" % data["chk_upload_helper.fetched_bytes"]) |
|---|
Note: See
TracBrowser
for help on using the repository browser.