1

我对 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

}

我期望它应该给出的结果是我的表空间使用量将在多少天内 100% 满。

但是输出有点奇怪,我不确定问题是什么。模板的样本输出是

" 主题正常:Oracle 表空间:(NaNB/NaNB) NaN%(预计剩余 -3650.00 天)正文

确认警报

在 Bosun 的规则页面查看规则 + 模板

注意:当在 Oracle 表空间可用空间中检测到问题时会触发此警报。

在 Opserver 中查看 Host dba

主机:testhost # 磁盘:

可用空间:NaN% 已使用:NaNB 总计:NaNB Est。-3650.00 天,直到 0% 可用空间“剩余的估计天数、可用空间、已用、总计的值出现错误。有人可以帮我纠正警报吗?

谢谢

4

0 回答 0