-
StackOverflow 文档
-
Bosun 教程
-
完整的例子
-
Linux Bonding Health
模板定义
template linux.bonding {
subject = {{.Last.Status}}: {{.Eval .Alert.Vars.by_host}} bad bond(s) on {{.Group.host}}
body = `{{template "header" .}}
<h2>Bond Status</h2>
<table>
<tr><th>Bond</th><th>Slave</th><th>Status</th></tr>
{{range $r := .EvalAll .Alert.Vars.slave_status}}
{{if eq $.Group.host .Group.host}}
<tr>
<td>{{$r.Group.bond}}</td>
<td>{{$r.Group.slave}}</td>
<td {{if lt $r.Value 1.0}} style="color: red;" {{end}}>{{$r.Value}}</td>
</tr>
{{end}}
{{end}}
</table>
`
}
警报定义
alert linux.bonding {
template = linux.bonding
macro = host_based
$notes = This alert triggers when a bond only has a single interface, or the status of a slave in the bond is not up
$slave_status = max(q("sum:linux.net.bond.slave.is_up{bond=*,host=*,slave=*}", "5m", ""))
$slave_status_by_bond = sum(t($slave_status, "host,bond"))
$slave_count = max(q("sum:linux.net.bond.slave.count{bond=*,host=*}", "5m", ""))
$no_good = $slave_status_by_bond < $slave_count || $slave_count < 2
$by_host = max(t($no_good, "host"))
warn = $by_host
}
通知 Priview
http://i.stack.imgur.com/8kolx.jpg