Mar*_*eck 1 monitoring pid monit centos6
我必须monit
监视一个进程,但它没有意识到它已关闭。我的监控配置是这样的:
check process xxx with pidfile /var/run/xxx.pid
group yyy
start program = "/etc/init.d/xxx start"
stop program = "/etc/init.d/xxx stop"
if failed host 127.0.0.1 port 9999 then restart
if 5 restarts within 5 cycles then timeout
Run Code Online (Sandbox Code Playgroud)
问题是即使我的进程崩溃了,PID 文件仍然存在。所以...PID 存在但本地主机中的端口 9999 应该失败。那么... monit 是否应该不重启这个过程?应该删除pid文件吗?不能做那种OR
?
提前致谢,
如果我错了,请纠正我:
常见的行为是关于端口 9999。你可以使用这样的东西来监视它:
check host 127.0.0.1 with address 127.0.0.1
start program = "/etc/init.d/xxx restart"
stop program = "/etc/init.d/xxx stop"
if failed port 9999 then restart
Run Code Online (Sandbox Code Playgroud)
以上应该足以涵盖所有情况,但您可以将其添加为现有声明的附加声明(这将是OR
您正在谈论的那种)。
查看有关 check host的文档。
PS:
我认为,关于文档(关于 Apache 的示例),如果无法访问端口 9999,即使 PID 文件仍然存在,您拥有的配置也应该能够重新启动您的进程。我的猜测是端口 9999 没有关闭,或者端口 9999 没有侦听 127.0.0.1(请使用 来检查所有这些netstat
)。
所以,在你的配置中,尝试用这个替换端口监视器行:
if failed port 9999 then restart
(删除host 127.0.0.1
)。
归档时间: |
|
查看次数: |
5242 次 |
最近记录: |