diff options
author | Richard Wall <richard@aziz> | 2010-08-01 12:12:55 +0100 |
---|---|---|
committer | Richard Wall <richard@aziz> | 2010-08-01 12:12:55 +0100 |
commit | d9601a87d071f066f0c58d3a8b93687e0d0969c4 (patch) | |
tree | 1f6bde7c4af497aa421113ceffe05258c86c3822 /docs/rrd_finder.rpy | |
parent | a8767f33f43d23c78ed7c93482278f90847ce00a (diff) |
get rid of the separate loading of the available rrd listv10.7
Diffstat (limited to 'docs/rrd_finder.rpy')
-rw-r--r-- | docs/rrd_finder.rpy | 20 |
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() |