This section gives some examples to get started quickly creating simple graphs.
The only required parameter is
q which specifies the query expression for
a line. The other two common parameters are for setting the start time,
s, and the end time,
for the data being shown. Usually the start time will be set relative to the end time, such as
e-3h, which indicates 3 hours before the end time. See time parameters for
more details on time ranges.
Putting it all together:
/api/v1/graph? e=2012-01-01T00:00 &q= name,sps,:eq &s=e-2d
The resulting PNG plot displays time along the X axis, automatically scaled to the proper time range. The Y axis labels are scaled using metric prefixes to show the measured value. A legend is displayed under the plot with the name(s) of the expression results and a set of statistics computed on the plotted data for the time window. The small text at the very bottom reflect query parameters and step size along with some processing statistics.
Adding a Title¶
The graph title can be set using the
title parameter. Similarly, a Y-axis label can be set
/api/v1/graph? e=2012-01-01T00:00 &q= name,sps,:eq &s=e-2d &title=Starts+Per+Second &ylabel=sps
Multiple expressions can be placed on a chart by concatenating the expressions, e.g., showing a query expression along with a constant value:
/api/v1/graph? e=2012-01-01T00:00 &q= name,sps,:eq, 500e3 &s=e-2d
Multiple lines can also be a result of a single expression via group by.
If used with a group by, then either:
- Both sides have the same group by clause. In this case an inner join will be preformed and the binary operation will be applied to the corresponding entries from both sides.
- One side is not a grouped expression, and the binary operation will be applied for each instance in the grouped result set.
Both Sides Grouped¶
Dividing by self with both sides grouped:
One Side Grouped¶
Dividing a grouped expression by a constant:
Equivalent to the previous expression, but the right-hand side is grouped and it uses multiply instead of divide: