我对Bosun很新,并一直在尝试为表空间使用配置预测警报。我将粘贴我的模板和警报代码
template predict_diskspace {
body = `{{template "header" .}}
<p>Host: <a href="{{.HostView .Group.host | short }}">{{.Group.host}}</a>
#<br>Disk: {{.Group.disk}}
<p>Free Space: {{.Eval .Alert.Vars.free_space | printf "%.2f"}}%
<br>Used: {{.Eval .Alert.Vars.used | bytes}}
<br>Total: {{.Eval .Alert.Vars.total | bytes}}
<br>Est. {{.Eval .Alert.Vars.days_to_full | printf "%.2f"}} days remain until 0% free space
{{/* .Graph .Alert.Vars.percent_free_graph */}}
`
subject = {{.Last.Status}}: Oracle Tablespace: ({{.Alert.Vars.used | .Eval | bytes}}/{{.Alert.Vars.total | .Eval | bytes}}) {{.Alert.Vars.free_space | .Eval | printf "%.2f"}}% (Est. {{.Eval .Alert.Vars.days_to_full | printf "%.2f"}} days remain)
}
alert predict_orcl_tbs {
$notes = This alert triggers when there are issues detected in Oracle tablespace free space (hopefully).
template=predict_diskspace
$filter=host=testhost,tablespace_name=*,oracle_database=*
## Forecast Section
$days_to_full=(forecastlr(q("sum:6h-avg:oracle.tablespace_usage{$filter}", "7d", ""), 0) / 60 / 60 / 24)
$warn_days = $days_to_full > 0 && $days_to_full < 7
$crit_days = $days_to_full > 0 && $days_to_full < 1
##Percent Free Section
$pf_time = "5m"
$used = avg(q("max:oracle.tablespace_usage{$filter}", $pf_time, ""))
$total = avg(q("sum:oracle.tablespace_usage{$filter}", $pf_time, ""))
$free_space = $total - $used
# For Graph
$percent_free_graph = q("avg:1h-min:oracle.tablespace_usage{$filter}", "4d", "")
warn = $warn_days
crit = $crit_days
}
我期待它应该给出的结果,就像我的表空间使用量将是多少天一样。
但输出有点奇怪,我不确定问题是什么。模板的样本输出是
&#34; 学科 normal:Oracle表空间:(NaNB / NaNB)NaN%(预计剩余-3650.00天) 体
确认提醒
在Bosun的规则页面中查看规则+模板
注意:当在Oracle表空间可用空间中检测到问题时,将触发此警报。
在Opserver中查看主机dba
主持人:testhost# 盘:
自由空间:NaN% 使用:NaNB 总计:NaNB 美东时间。 -3650.00天仍然是0%的可用空间 &#34; Est的值。剩余天数,可用空间,已用,总计出错。有人可以帮我纠正警报吗?
由于