使用 Merge 組合系列
如果要在一個圖形上繪製兩個系列圖形,可以使用“ 合併” 功能。這也可以與 Series 函式結合使用來操作 Y 軸(就像強制它從零開始一樣)。
template graph.template {
subject = ...
body = `{{template "header" .}}
<strong>Graph With Merge+Series so Y Axis Starts At Zero</strong>
<div>{{.Graph .Alert.Vars.graph_merged .Alert.Vars.graph_unit}}</div>
`
}
alert os.low.memory {
template = graph.template
...
$graph_time = "1d"
$graph_host = q("avg:300s-avg:os.mem.percent_free{host=myhost}", $graph_time, "")
$graph_unit = Notice the Y axis always starts at zero now
$graph_series = series("value=zero", epoch()-d($graph_time), 0, epoch(),0)
$graph_merged = merge($graph_host,$graph_series)
...
}