master
Tomek Dubrownik 2013-03-04 18:20:06 +01:00
commit 51ace626ce
1 changed files with 17 additions and 0 deletions

17
dash-extract.py Normal file
View File

@ -0,0 +1,17 @@
import requests as r
import json
from sys import argv
URL = 'http://graphite.hackerspace.pl/dashboard/load/%s'
dash = r.get(URL % argv[1]).json
out = {}
for n, g in enumerate(dash['state']['graphs']):
url = g[2] + '&format=json'
title = g[1].get('title', 'Graph ' + str(n))
parent = '#graph_div_' + str(n)
out[title] = dict(source=url, TimeSeries=dict(parent=parent, title=title))
print json.dumps(out, indent=2)