The Graphite Render API is a powerful way to query your metric data saved in Hosted Graphite. With the Graphite Render API you can:
Used to make render queries that can be easily integrated into external or self-built tools.
To integrate Hosted Graphite data externally, Create an Access Key to authorize render requests. Copy the key URL and add /render?target=
For example:
https://www.hostedgraphite.com/YOUR-UID/<Access_Key>/graphite/render?target=
The render endpoint when signed-in to your account is:
https://www.hostedgraphite.com/YOUR-UID/graphite/render?target=
This parameter specifies the path to identify one or more metrics and also supports wildcards (*).
Note: The default Data Views applied to the query is “avg” which might not always be useful depending on the type of metric. Change this by appending the desired data view to the metric name separated by a colon (:). Refer to the Examples below.
These parameters are optional and accept relative or absolute times (or a combination of both). Relative Time is the length of time from the current time and is always peceded with a minus sign (-). If no time parameters are specified, the default values are from=now-24h and to=now.
The accepted units of time are:
Abbreviation | Unit |
---|---|
s | Seconds |
min | Minutes |
h | Hours |
d | Days |
w | Weeks |
mon | Month (30 Days) |
y | Year (365 Days) |
For Example:
https://www.hostedgraphite.com/YOUR-UID/graphite/render?target=foo.bar.*&from=now-1w
If unspecified, the default format is png. Using the &format= argument you can decide how you want to view your data:
Using sample metric foo.bar, below are some example queries and outputs (click the images to enlarge):
https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=foo.bar&from=now-30min
https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=alias(foo.bar,"Uptime")&from=now-30min
https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=foo.bar&from=now-30min&format=json
https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=foo.bar:max&from=now-30min&format=json
Curl Example:
curl -X GET "https://www.hostedgraphite.com/YOUR-UID/ACCESS-KEY/graphite/render?target=foo.bar:max&from=now-30min&format=json"
For more information about building queries and customizing outputs, visit the Graphite Render Docs.