Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to get raw Graphite data for multiple graphs in one call... is it possible to nest targets?

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?


1 Answers

Sorry, but it's not possible - the Graphite web app just isn't designed for that use-case.

You could always make a an issue / pull request with a new function for that on the graphite-web app app.

like image 133
rowanu Avatar answered Dec 10 '25 23:12

rowanu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!