【问题标题】:How to re-alert Monit?如何重新提醒Monit?
【发布时间】: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


    【解决方案1】:

    我已经设法通过添加 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
    

    【讨论】:

      【解决方案2】:

      你应该使用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
      

      它应该像这样工作!

      【讨论】:

      • 嗨皮埃尔,感谢您的回复,我已经尝试了解决方案,并且我想出了 1400 个周期/天。这会引发一个错误,指出最大周期为 64。
      • 嗯,我不知道..也许,如果你只有这个测试,你可以减少你的周期持续时间?或者可能添加一行if status > 10 for 1400 cycles then alert(但我想有同样的限制..)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-03
      • 2018-10-12
      • 2022-11-30
      相关资源
      最近更新 更多