【发布时间】:2013-09-26 23:45:31
【问题描述】:
我目前正在开发一个 Monit 配置,当某个状态达到阈值时会发出警报。
check program check_something with path "/root/scripts/check_something.sh"
if status > 10 then alert
上述配置运行良好,如果状态仍然超过阈值,我想每天添加一个重复警报。
【问题讨论】:
标签: monitoring monit
我目前正在开发一个 Monit 配置,当某个状态达到阈值时会发出警报。
check program check_something with path "/root/scripts/check_something.sh"
if status > 10 then alert
上述配置运行良好,如果状态仍然超过阈值,我想每天添加一个重复警报。
【问题讨论】:
标签: monitoring monit
我已经设法通过添加 86400 秒的 timeout 来解决这个问题,这相当于 1 天。
check program check_something with path "/root/scripts/check_something.sh"
if status > 10 then alert
if status > 10 with timeout 86400 seconds then alert
【讨论】:
你应该使用setting an error reminder。
首先,获取周期的持续时间。它通常在 /etc/monitrc 文件中,set daemon n 其中 n 是持续时间。
然后,如果你想要每天一个,计算每天的周期数:
number_cyle_per_day = 24*60*60/n
最后,在你的脚本中使用它:
check program check_something with path "/root/scripts/check_something.sh"
if status > 10 then alert reminder on number_cyle_per_day cycles
它应该像这样工作!
【讨论】:
if status > 10 for 1400 cycles then alert(但我想有同样的限制..)