18 lines
434 B
Python
18 lines
434 B
Python
|
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)
|