Bosun Graph using Alert Variable


Example

Using .Graph will filter the results to only include those that match the tagset for the alert. For instance an alert for os.low.memory{host=ny-web01} would only include series with the host=ny-web01 tags. If multiple series match then only the first matching result will be used.

template graph.template {
    subject = ...

    body = `{{template "header" .}}

    <strong>Graph</strong>
    <div>{{.Graph .Alert.Vars.graph}}</div>

    <strong>Graph With Y Axis Label Literal</strong>
    <div>{{.Graph .Alert.Vars.graph "Free Memory in GB"}}</div>

    <strong>Graph With Y Axis Label From Variable</strong>
    <div>{{.Graph .Alert.Vars.graph .Alert.Vars.graph_unit}}</div>

    `
}

alert os.low.memory {
    template = graph.template
    ...
    $graph = q("avg:300s-avg:os.mem.percent_free{host=$host}", "1d", "")
    $graph_unit = Percent Free Memory (Including Buffers and Cache)
    ...
}