【发布时间】:2015-11-10 02:30:22
【问题描述】:
我在 Debian Jessie 上运行 M/Monit 5.14。我有一张这样的支票:
check program myscript with path "/etc/monit/scripts/test.sh"
if status != 0 then exec "/etc/monit/scripts/record_failure.sh"
if status == 0 then exec "/etc/monit/scripts/record_success.sh"
想法是这些record 脚本将在每次运行时发送该测试的结果记录。当然,还有其他方法可以做到这一点,但这只是我在这种情况下采取的特定路线。我更担心添加status == 0 行会使监视检查总是失败,即使monit status 中的最后一个结果是0 和record_success.sh 正在运行。
the site 上对此没有任何记录。是因为存在匹配条件而导致检查失败,还是我弄乱了语法?
【问题讨论】: