summaryrefslogtreecommitdiff
path: root/docs/rrd_finder.rpy
diff options
context:
space:
mode:
Diffstat (limited to 'docs/rrd_finder.rpy')
-rw-r--r--docs/rrd_finder.rpy20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/rrd_finder.rpy b/docs/rrd_finder.rpy
new file mode 100644
index 0000000..c7c8517
--- /dev/null
+++ b/docs/rrd_finder.rpy
@@ -0,0 +1,20 @@
+import json
+import os
+
+from twisted.python.filepath import FilePath
+from twisted.web.resource import Resource
+
+RRD_PATH = '/var/lib/collectd/rrd/aziz/'
+URL_BASE = 'data'
+
+class RrdFinder(Resource):
+ isLeaf = True
+ def render_GET(self, request):
+ p = FilePath(RRD_PATH)
+ paths = []
+ for f in p.walk():
+ if f.basename().endswith('.rrd'):
+ paths.append(os.path.join(URL_BASE, *f.segmentsFrom(p)))
+ return json.dumps(paths)
+
+resource = RrdFinder()