在 monit 中时间戳检查失败后应用程序无法启动

Application failed to start after timestamp check failed in monit

我有一个简单的监控控制文件,其中包含以下内容

check process fooBar1 with pidfile fooBar1PidFile
   start program = "/etc/init.d/fooBar1 start" with timeout 10 seconds
   stop program = "/etc/init.d/fooBar1 stop"
   if 5 restarts within 5 cycles then unmonitor

check process fooBar2 with pidfile fooBar2PidFile
   start program = "/etc/init.d/fooBar2 start" with timeout 10 seconds
   stop program = "/etc/init.d/fooBar2 stop"
   if 5 restarts within 5 cycles then unmonitor

check process fooBar with pidfile fooBarPidFile
   start program = "/etc/init.d/fooBar start" with timeout 10 seconds
   stop program = "/etc/init.d/fooBar stop"
   if 5 restarts within 5 cycles then unmonitor
   if memory usage > 25.0 MB for 4 cycles then alert
   depends on fooBar1
   depends on fooBar2
   depends on checkFile


check file checkFile with path pathToFile
   if timestamp > 4 minute for 8 cycles then restart

此处的目的是在 checkFile 的时间戳检查失败时重新启动 fooBarfooBar1fooBar2 应用程序。但实际发生的是它试图重新启动 checkFile 而不是 fooBar.

此检查在 monit 版本 5.5 中工作正常,但在 5.18 中不工作。

这是我在 timestamp 失败并经过 8 个周期后得到的结果。

'checkFile' timestamp for pathToFile failed -- current timestamp is Fri, 08 Dec 2017 12:47:04
'fooBar' failed to start -- could not start required services: 'checkFile'
'fooBar' start action failed

我是不是漏掉了什么? 提前致谢

尝试变通,

check file checkFile with path pathToFile
    if timestamp > 4 minute for 8 cycles then
    exec "/etc/init.d/fooBar restart"
    repeat every 1 cycles

这是在时间戳检查失败时每个周期重新启动应用程序 fooBar。但只是想知道还有其他更好的方法吗?