diff options
author | Richard Wall <richard@aziz> | 2010-06-13 12:37:50 +0100 |
---|---|---|
committer | Richard Wall <richard@aziz> | 2010-06-13 12:37:50 +0100 |
commit | cbaeb0b773cc6401943250edcdac82c6a9a71ca8 (patch) | |
tree | ed1fb7a4af5682099d0a718ab0636a5e2c88acc4 /rrd_finder.rpy | |
parent | 57b58f83bde08b385a7a997f1d35c43683b34b9b (diff) |
Build charts based on a downloaded list of available rrd files
Diffstat (limited to 'rrd_finder.rpy')
-rw-r--r-- | rrd_finder.rpy | 20 |
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() |