| 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 free space |
|---|
| 5 | # is left on all disks across the grid. The plugin should be configured with |
|---|
| 6 | # env_url= pointing at the diskwatcher.tac webport. |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | import os, sys, urllib, json |
|---|
| 10 | |
|---|
| 11 | if len(sys.argv) > 1 and sys.argv[1] == "config": |
|---|
| 12 | print("""\ |
|---|
| 13 | graph_title Tahoe Remaining Disk Space |
|---|
| 14 | graph_vlabel bytes remaining |
|---|
| 15 | graph_category tahoe |
|---|
| 16 | graph_info This graph shows the total amount of disk space left available in the grid |
|---|
| 17 | disk_left.label disk left |
|---|
| 18 | disk_left.draw LINE1""") |
|---|
| 19 | sys.exit(0) |
|---|
| 20 | |
|---|
| 21 | url = os.environ["url"] |
|---|
| 22 | data = json.load(urllib.urlopen(url))["available"] |
|---|
| 23 | print("disk_left.value", data) |
|---|
Note: See
TracBrowser
for help on using the repository browser.