bd808 / graphite-graph-php

PHP DSL for generating Graphite graph specifications
http://bd808.com/graphite-graph-php
BSD 2-Clause "Simplified" License
16 stars 6 forks source link

Applying threshold lines #25

Closed chjohnst closed 11 years ago

chjohnst commented 12 years ago

What is the best way to apply a threshold for say a warning or critical line per graph?

bd808 commented 12 years ago

If you are using the ini syntax I would start with:

[critical]
:generator = "threshold"
threshold[] = 15
threshold[] = "critical"
threshold[] = "red"

This will add a threshold(15,'critical','red') series to the generated URL.

The equivalent in the php DSL would be:

$g = Graphite_GraphBuilder::builder()
    ->buildSeries('critical')
    ->threshold(15, 'critical', 'red')
    ->endSeries();
chjohnst commented 12 years ago

I will try that out, I was getting errors when I did but will give it a go again.

chjohnst commented 12 years ago

Shouldn't this draw an actual line across the graph? It seems to just be making my graph zoom in. For example I have a warning of 8.0 and critical of 10.0 for system load. On hosts that have a very light load I have this huge graph with that goes from 0.0 to 10.0.

bd808 commented 12 years ago

Graphite will always draw the threshold line on the graph (unless you explicitly set the maxY). Adding a threshold(10, 'critical') series to the graph will guarantee that your y-axis runs up to at least 10. AFAIK Graphite does not currently support a "display threshold if and only if exceeded" function.