监控未启动过程-执行失败错误

时间:2018-08-13 06:56:33

标签: ruby-on-rails ruby monitoring sidekiq monit

我正在使用monit gem监视我的sidekiq进程 我的Monitrc配置文件:-

check process sidekiq_process with pidfile /home/path_to_pid
start program = "bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e development"  with timeout 60 seconds
stop program  = "bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e development"

我的sidekiq.yml文件:-

 development:
:pidfile: tmp/pids/sidekiq_development.pid
:logfile: log/sidekiq_development.log
:concurrency: 1

使用bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e development运行sidekiq然后运行sudo monit之后,sudo monit status会给我以下信息:-

Process 'sidekiq_process'
status                            Running
monitoring status                 Monitored
pid                               10951
parent pid                        1378
uid                               1000
effective uid                     1000
gid                               1000
uptime                            0m 
threads                           2
children                          0
memory                            103.4 MB
memory total                      103.4 MB
memory percent                    1.3%
memory percent total              1.3%
cpu percent                       0.0%
cpu percent total                 0.0%
data collected                    Mon, 13 Aug 2018 12:14:06

因此,它的监视很好,当我杀死sidekiq进程时,它甚至向我发送“不存在”邮件,但问题是在sidekiq进程被杀死之后,它也应该重新启动该进程。这是sudo monit status在杀死sidekiq之后给我的东西

Process 'sidekiq_process'
status                            Execution failed
monitoring status                 Monitored
data collected                    Mon, 13 Aug 2018 12:19:13

我还收到一封邮件,指出“执行失败”。
为什么我会收到执行失败的错误,为什么进程无法通过monit重新启动?

1 个答案:

答案 0 :(得分:0)

将您的exec命令包装在shell脚本中,然后chmod + x,然后检查我的回答here