Monitoring 如何重新提醒Monit?

Monitoring 如何重新提醒Monit?,monitoring,monit,Monitoring,Monit,我目前正在开发一个Monit配置,当某个状态达到阈值时会发出警报 check program check_something with path "/root/scripts/check_something.sh" if status > 10 then alert 上面的配置运行良好,如果状态仍然超过阈值,我想每天添加一个重复警报。您应该使用 check program check_something with path "/root/scripts/check_something

我目前正在开发一个Monit配置,当某个状态达到阈值时会发出警报

check program check_something with path "/root/scripts/check_something.sh"
  if status > 10 then alert
上面的配置运行良好,如果状态仍然超过阈值,我想每天添加一个重复警报。

您应该使用

check program check_something with path "/root/scripts/check_something.sh"
  if status > 10 then alert
首先,抓住你周期的持续时间。它通常位于
/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
它应该是这样工作的

您应该使用

首先,抓住你周期的持续时间。它通常位于
/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

它应该是这样工作的

我设法解决了这个问题,增加了86400秒的超时时间,相当于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

我设法解决了这个问题,增加了86400秒的超时时间,相当于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

嗨,Pierre,谢谢你的回复,我已经尝试了这个解决方案,我想出了1400个周期/天。这会抛出一个错误,说最大周期是64。嗯,我不知道。。也许,如果你只是做了这个测试,你可以缩短你的周期?或者,如果1400个周期的状态>10,则可能添加一行
,然后发出警报
(但我猜也有相同的限制。)嗨,Pierre,感谢您的回复,我已经尝试了解决方案,我已经想出了1400个周期/天。这会抛出一个错误,说最大周期是64。嗯,我不知道。。也许,如果你只是做了这个测试,你可以缩短你的周期?或者,如果状态>10持续1400个循环,则可能添加一行
,然后发出警报
(但我猜也有相同的限制..)