| Line | |
|---|
| 1 | #!/usr/bin/env python |
|---|
| 2 | |
|---|
| 3 | # This is a munin plugin which pulls data from the server in |
|---|
| 4 | # misc/operations_helpers/spacetime/diskwatcher.tac . It produces a graph of how much space is |
|---|
| 5 | # present on all disks across the grid, and how much space is actually being |
|---|
| 6 | # used. The plugin should be configured with env_url= pointing at the |
|---|
| 7 | # diskwatcher.tac webport. |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | import os, sys, urllib, json |
|---|
| 11 | |
|---|
| 12 | if len(sys.argv) > 1 and sys.argv[1] == "config": |
|---|
| 13 | print("""\ |
|---|
| 14 | graph_title Tahoe Total Disk Space |
|---|
| 15 | graph_vlabel bytes |
|---|
| 16 | graph_category tahoe |
|---|
| 17 | graph_info This graph shows the total amount of disk space present in the grid, and how much of it is currently being used. |
|---|
| 18 | disk_total.label disk total |
|---|
| 19 | disk_total.draw LINE2 |
|---|
| 20 | disk_used.label disk used |
|---|
| 21 | disk_used.draw LINE1""") |
|---|
| 22 | sys.exit(0) |
|---|
| 23 | |
|---|
| 24 | url = os.environ["url"] |
|---|
| 25 | data = json.load(urllib.urlopen(url)) |
|---|
| 26 | print("disk_total.value", data["total"]) |
|---|
| 27 | print("disk_used.value", data["used"]) |
|---|
Note: See
TracBrowser
for help on using the repository browser.