我怎样才能让monit继续在一段时间内提醒我,直到条件解决? 这是一个configuration示例:
使用path/ dev / sda1检查文件系统datafs 如果在15个周期内5次使用空间> 80%,则警报
在这里,我会得到一个警报,然后不再。 我希望在问题得到解决之前不要闭嘴。
从monit手册:
alert foo@bar with reminder on 1 cycle
每当过程检查一旦处于失败状态(例如相当多)时,就会重复该警报。 你可能想设置这个,所以它只会提醒你永远不到一个小时
这似乎是设置在您设置警报目标的地方,而不是在检查节。 但是,您可以为单个检查/服务以及全局检查/服务指定警报目标。
check filesystem datafs with path /dev/sda1 alert foo@bar on { resource } with reminder on 10 cycles if space usage > 80% for 5 times within 15 cycles then alert
缺省是在触发器匹配时进行提示,并在服务成功时再次提醒。 因此,如果磁盘利用率在79%和81%之间变动,则会在达到阈值时收到警报。
但是,您需要在警报触发后进行提醒。 您可以使用Monit中的提醒function来执行此操作。
这是来自Monit的示例configuration:
For example if you want to be notified each tenth cycle if a service remains in a failed state, you can use: alert foo@bar with reminder on 10 cycles Likewise if you want to be notified on each failed cycle, you can use: alert foo@bar with reminder on 1 cycle
你可以用这种语言扩展你的节:
check filesystem datafs with path /dev/sda1 if space usage > 80% for 5 times within 15 cycles then alert
但是您必须修改您的全局set alert声明或在检查节级别更改它:
set alert [email protected] with reminder on 5 cycles