From: Brian Warner <warner@allmydata.com>
Date: Tue, 25 Mar 2008 20:15:52 +0000 (-0700)
Subject: add a munin plugin to display introducer stats
X-Git-Tag: allmydata-tahoe-1.0.0~4
X-Git-Url: https://git.rkrishnan.org/simplejson/components/rgr-080307.php?a=commitdiff_plain;h=490f815e8f4b4d18a3d8125e2666becad43a0a2d;p=tahoe-lafs%2Ftahoe-lafs.git

add a munin plugin to display introducer stats
---

diff --git a/misc/munin/tahoe-introstats.py b/misc/munin/tahoe-introstats.py
new file mode 100644
index 00000000..50158b02
--- /dev/null
+++ b/misc/munin/tahoe-introstats.py
@@ -0,0 +1,27 @@
+#! /usr/bin/python
+
+import os, sys
+import urllib
+import simplejson
+
+configinfo = """\
+graph_title Tahoe Introducer Stats
+graph_vlabel hosts
+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_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"]
+
+data = simplejson.loads(urllib.urlopen(url).read())
+print "storage_server.value %d" % data["announcement_summary"]["storage"]
+print "storage_client.value %d" % data["subscription_summary"]["storage"]
+