Url Api Reference

Getting images out of graphite

Creating Line Graphs

Images are created from an HTTP request with the appropriate parameters.

All calls require at least one 'target' parameter. This parameter must either be a graphite path or a function (such as avg). To graph multiple things at once, simply specify multiple 'target' parameters, for example:

target=a.b.c&target=x.y.z&target=avg(a.b.c,x.y.z)

All other paramaters are optional.

  • from and until must be a time specification conforming to the AT-STYLE time specification described here: http://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html.
  • width and height parameters for the image size.
  • template may be used for alternate coloring schemes. Try the "plain" template.
  • title and vtitle set the image title and vertical title.
  • lineWidth sets the line thickness, by default this is set depending on the size of the image.
  • yMin and yMax set the minimum and maximum y-values for the generated image. A good use of these parameters would be min=0&max=100 when the value you are graphing is a percentage.
  • graphOnly may be set to any value to have the graph drawn with no legend. This is handy for making thumbnails.
  • hideLegend hides the graph legend.
  • hideGrid hides the background grid.
  • hideAxes hides both the x and y axis labels as well as the background grid.
  • lineMode may be either "slope" (the default) or "staircase".
  • areaMode may be "none" (the default), "first", or "all". This causes the area under lines to be shaded in, when using "all" you may need to use an alpha masked color.
  • colorList may be a comma-separated list of colors. A color can be one of the following known aliases: black, white, blue, green, red, yellow, purple, brown, aqua, grey, magenta, pink, gold, rose, darkblue, darkgreen, darkred, darkgrey. A color can also be an HTML-style hex color (ie. "#ff0000" or cceedd). Additionally, hex colors can have an addition hex number specifying the alpha mask (ff is 100% opaque, 00 is 100% transparent). So for instance "ff000088" would be semi-transparent red. Alpha masks are very useful when using areaMode=all.

Here is a simple example
http://my-graphite-server/render?from=-6h&target=carbon.agents.*.*&title=My%20First%20Graph

Getting raw numerical data out of Graphite

Graphite can return numerical data in a CSV format by simply adding a "rawData=true" url parameter to any graphite image url. The output format is as follows:

target1, startTime, endTime, step | value1, value2, ..., valueN
target2, startTime, endTime, step | value1, value2, ..., valueN
...

Each line corresponds to a graph element. Everything before the "|" on a given line is header information, everything after is numerical values. The header describes the name of the target, the start and end times (in unix epoch time) of the retrieved interval, and the step is the number of seconds between datapoints. So the timestamp of value1 is startTime, the timestamp of value2 is (startTime+step), value3 is (startTime+step+step), etc…

Note that non-existent or null values in a series are represented by the string "None".

Creating Pie Graphs

Pie graphs are created very similarly to Line Graphs with a few exceptions. Pie graphs are drawn from the same base URL as line graphs, /render. But in order to make a pie graph instead of a line graph, you must include the parameter "graphType=pie"

Pie graphs display parts comprising a whole. Unlike line graphs which display time-series stored on the graphite server, you must supply your own values for the pie graph you draw. Each part of your pie corresponds to a 'target' url parameter of the form 'name':'value'

Here's a simple example

http://my-graphite-server/render?graphType=pie&target=alpha:111&target=beta:222&target=gamma:333

That's it. The following options can be specified and have the same effects as for line graphs: width, height, template, colorList, hideLegend, title. There are also two new parameters specific to pie charts:

  • valueLabels Must be one of "none", "number", "percent". This specifies how to label each slice. Defaults to "percent".
  • valueLabelsMin Must be a number. Slices with a value (or percent, depending on valueLabels) less than this will not have a label.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License