From d9601a87d071f066f0c58d3a8b93687e0d0969c4 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Sun, 1 Aug 2010 12:12:55 +0100 Subject: get rid of the separate loading of the available rrd list --- docs/rrd_finder.rpy | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/rrd_finder.rpy (limited to 'docs/rrd_finder.rpy') 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() -- cgit v1.2.3