Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to access Graphite data programmatically? [closed]

Tags:

api

graphite

What is the best way to access data from Graphite render API?

https://graphite.readthedocs.org/en/latest/render_api.html#data-display-formats

Is there a JVM compatible client implementation? Or there is a possibility to retrieve this data using some other API?

I do realise that the format is self descriptive and it is not a rocket science, but it would be great to reuse and contribute rather than writing from scratch.

like image 369
Dmitry Buzdin Avatar asked Nov 19 '13 13:11

Dmitry Buzdin


People also ask

How do I access graphite database?

You can access the Dashboard interface directly at http://my.graphite.host/dashboard , or via the link at the top of the Composer interface.

What is graphite in monitoring?

Graphite is an enterprise-ready monitoring tool that runs equally well on cheap hardware or Cloud infrastructure. Teams use Graphite to track the performance of their websites, applications, business services, and networked servers.

How do you transfer metrics to graphite?

Send metrics to Graphite # To send metrics to Graphite you need to at least configure the Graphite host: --graphite. host . If you don't run Graphite on default port you can change that to by --graphite.


1 Answers

The render api, as you mentioned, allows the following variables along with the API call-

&format=png
&format=raw
&format=csv
&format=json
&format=svg

For implementations such as , you can make straightforward curl calls like:

curl "http://graphite.com/render/?target=carbon.agents.host.creates&format=json"

The call would return:

[{
    "target": "carbon.agents.ip-10-0-0-111-a.creates", 
    "datapoints": [
        [4.0, 1384870140], 
        [1.0, 1384870200], 
        [18.0, 1384870260], 
        [0.0, 1384870320], 
        [4.0, 1384870380], 
        [12.0, 1384870440], 
        [3.0, 1384870500],
        [7.0, 1384870560], 
        [8.0, 1384870620], 
        [null, 1384870680]
    ]
}]

Since it is this straightforward, therefore it'd be pretty lame to implement something just for making curl calls. What the community has done is that they are using these as fundamental building blocks for custom frontends, querying scripts that alert, nagios plugins etc.

Is there something more specific that you are looking for?

like image 73
erbdex Avatar answered Oct 23 '22 01:10

erbdex