Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Drawing Horizontal Lines

ripienaar edited this page Dec 17, 2011 · 4 revisions

You can draw simple horizontal lines on a graph, lines can have any color, caption or value. They can also optionally be dashed:

title          "Horizontal Lines"
width          400
height         250
ymin           0
ymax           125

line :caption => "Critical", :value => 100, :color => "red"
line :caption => "Warning",  :value =>  50, :color => "orange", :dashed => true

lines.png

If you are adding Critical and Warning thresholds specifically as above there are special helpers for this that will create them with predictable names.

These predictable names will be used by a future Nagios check that can provide automatic monitoring of graphs.

warning :value => [700, -700], :color => "orange"
critical :value => [800, -800], :color => "red"

If you do not specify the colors they will default as above. The lines will have names like crit_0, crit_1 etc.

While you can specify as many value items as you wish only really 1 or 2 makes sense, if you want to specify just 1 you can just do :value => 700

Sometimes you only want to record the thresholds for use by the Ruby API but not draw them - the thresholds might be large and obscure the data in the graph scale - you can hide the lines this way:

warning :value => [700, -700], :hide => true
critical :value => [800, -800], :hide => true

This way you can access the critical_threshold and warning_threshold methods of the GraphiteGraph object to gain access to these values but they will not be drawn.

Clone this wiki locally