To make my Graphite graphs more customizable and interactive, I am switching from Graphiti to getting the raw data and plotting it with a Javascript library (flot). I am getting raw JSON data from Graphite for each graph on my page about every 10 seconds, but I would like to get all of the data in a single GET request. I can ask for multiple targets, but I haven't found a way to organize them. Ideally, I would like to find a way to nest targets related to each graph into their own JSON object. I am trying to avoid having to parse through all of the target names and sort them into their perspective graph.
Example: If I do something like this:
mysite.com/graphite/render/?format=json&from=-1minute&target=aliasByNode(stats.production.api.response_codes.*,6)&target=aliasByNode(stats.production.app.*.CPUUtilization.Average,3)
I get back something like this:
[ {"target": "400", "datapoints": [...]},
{"target": "500", "datapoints": [...]},
{"target": "cpu.5", "datapoints": [...]},
{"target": "cpu.1", "datapoints": [...]},
{"target": "cpu.2", "datapoints": [...]},
{"target": "cpu.3", "datapoints": [...]},
{"target": "cpu.4", "datapoints": [...]},
{"target": "cpu.5", "datapoints": [...]} ]
And I would like to get back something like this:
[ {"api_errors": {
{"target": "400", "datapoints": [...]},
{"target": "500", "datapoints": [...]} },
{"cpu_utilization": {
{"target": "cpu.5", "datapoints": [...]},
{"target": "cpu.1", "datapoints": [...]},
{"target": "cpu.2", "datapoints": [...]},
{"target": "cpu.3", "datapoints": [...]},
{"target": "cpu.4", "datapoints": [...]},
{"target": "cpu.5", "datapoints": [...]} }
} ]
Does anyone have any ideas?