我们正在通过MONIT监视Sidekiq进程。一旦SideKiq进程到达大约2 GB的内存,我们将重新启动该过程。我们的开始和停止程序定义为90秒。但是停止程序正在失败(在等待90秒的超时之后)。
这是示例监视配置。
check process sidekiq
with pidfile /pathtopidfile
start program = "/bin/sh -c start sidekiq commmand" with timeout 90 seconds
stop program = "stop sidekiq command" with timeout 90 seconds
if totalmem is greater than 2GB for 3 cycles then restart
***## I need have some condition like this -> if "stop_program failed" then "do some action"***
end
p.s我不知道捕获停止程序的正确语法在Monit中失败了。我检查了Monit博客,但不能。
我认为,在监测中没有选择捕获停止程序或开始程序的失败。因此,我们必须在各自计划本身中处理这些失败案例。假设我的停止程序失败了,我必须找到为什么失败的原因,并在停止程序本身中采取相应的操作。
我最初的问题是sidekiq流程没有在超时内被杀死,因此停止程序失败了。为了解决这个问题,我已经在停止程序中处理了,如果sidekiq进程没有在超时内被杀死,然后硬杀程序。