使用 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)
...
}