Outdated Resource Warning!
This is documentation for legacy version 0.x
releases. If you are using 1.x see the wiki
Using Graphs Directly
In addition to displaying test history graphs in a view you can include them specifically in your own web pages as simple <img> images.
The only thing you need
to know and pass to the graph script is the ID of the test - this is a "class letter" (currently only L for local-test is used) and a number - for example L26.
This is passed as the variable testid in the URL.
In order for your graphs to be visible to web browsers not authenticated into FreeNATS you need to set the test.graph.public system variable to 1.
You can optionally set the variable test.graph.key to an alphanumeric string. Requests from public browsers must now provide this string in the URL as graphkey. Views will automatically use the graphkey.
This will allow you to use your graphs in unauthenticated environments but obviously also means potentially "exposing" your other graphs.
You can specify the start and end period of the graph using startx and finishx (which default to 0:00:00 and 23:59:59 respectively if unset). These time values can be specified either as 0 (now), a negative number (number of seconds before now) as as a positive number which is taken as "seconds past the epoch" (unixtime).
For example startx=-3600 would start the reporting period one hour before now.
Width and Height
var now=new Date();
Width and height are set with the width and height variables (in pixels), they default to 700 and 150 respectively if unset.
The data range (Y axes range) is controllable by the user by passing one or more of the variables mangemin, rangemax or rangemaxmin.
If a range value is unspecified it uses the relevant highest or lowest point in the data set returned for the period.
rangemin specifies the exact minimum (lowest point) of the scale.
rangemax specified the exact maximum (highest point) of the scale. Results higher than rangemax will be drawn going "off the top" of the graph. The alternative, rangemaxmin, specifies the "minimum maximum" of the range i.e. the rangemax will be this unless a higher data point is encountered in which case rangemax will be the highest point.
There are three types of output drawn onto the graph, the "spikes", track and "underline".
The spikes (variable draw_spikes 0 or 1 - defaults to 1 if unset) are the vertical bars drawn from the base to the test result in the colour of the alertlevel (green for passed, red for failed etc).
The track (variable draw_track 0 or 1 - defaults to 1 if unset) is the blue (by default - see the colours section below) track line over the top of the sample data.
The underline (variable draw_under 0 or 1 - defaults to 1 if unset) draws a thick line along the bottom axis in the relevant alert level colour. This is to help visibility of failures where the spike etc is often unseen as the result is 0 or negative.
By default the underline is only drawn (if on) for warning or failure levels. Pass results can be included with the variable draw_under_pass (0 or 1 - defaults to 0 if unset).
Titles and Units
A title can be passed in the title variable (if title is unset the value of nodeid will be used if that is set) and will be displayed centered at the top of the graph.
Units can be passed with the units variable and are displayed next to the Y axis under the rangemax figure. Multiple lines are specified with forward slashes (/) so whereas "MilliSeconds" will encroach on the graph area "Milli-/Seconds" will plot over two lines.
Colours can be set by passing "item
". The items which are available to be set are bgcol (background colour), txtcol (text colour) and axescol (axes colour).
"Named" colours available for use are black, white, red, blue, green, grey, orange, lightgreen and lightgrey.
For example "bgcol=black" gives a black background.
Defaults are a white background, grey axes and black text.
// Setup FreeNATS
// Set Style
// Set Dates and Times
var now=new Date();
// Last Hour
document.write('someserver.com last 60 minutes <br>');
// or we could have done
// Last Day
document.write('<br>someserver.com last 24 hours <br>');