From 6b416fc28c43cbcefebc0fc99a90cb32b25620c9 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Thu, 27 Mar 2008 16:50:30 -0700
Subject: [PATCH] helper: add another munin plugin

---
 misc/munin/tahoe-helperstats-active.py        | 24 +++++++++++++++++++
 ...rstats.py => tahoe-helperstats-fetched.py} |  0
 2 files changed, 24 insertions(+)
 create mode 100644 misc/munin/tahoe-helperstats-active.py
 rename misc/munin/{tahoe-helperstats.py => tahoe-helperstats-fetched.py} (100%)

diff --git a/misc/munin/tahoe-helperstats-active.py b/misc/munin/tahoe-helperstats-active.py
new file mode 100644
index 00000000..b143d3d7
--- /dev/null
+++ b/misc/munin/tahoe-helperstats-active.py
@@ -0,0 +1,24 @@
+#! /usr/bin/python
+
+import os, sys
+import urllib
+import simplejson
+
+configinfo = """\
+graph_title Tahoe Helper Stats - Active Files
+graph_vlabel bytes
+graph_info This graph shows the number of files being actively processed by the helper
+fetched.label Active Files
+fetched.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 "fetched.value %d" % data["CHK_active_uploads"]
+
diff --git a/misc/munin/tahoe-helperstats.py b/misc/munin/tahoe-helperstats-fetched.py
similarity index 100%
rename from misc/munin/tahoe-helperstats.py
rename to misc/munin/tahoe-helperstats-fetched.py
-- 
2.45.2