summaryrefslogtreecommitdiff
path: root/rrd_finder.rpy
diff options
context:
space:
mode:
Diffstat (limited to 'rrd_finder.rpy')
-rw-r--r--rrd_finder.rpy20
1 files changed, 20 insertions, 0 deletions
diff --git a/rrd_finder.rpy b/rrd_finder.rpy
new file mode 100644
index 0000000..c7c8517
--- /dev/null
+++ b/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()