2

I am using monit gem to monitor my sidekiq process My Monitrc config file:-

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"

My sidekiq.yml file:-

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

After running sidekiq using bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e development and then running sudo monit, sudo monit status gives me this:-

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

So, it is monitoring fine, it even sends me mail "Does not exist" when I kill the sidekiq process, but the problem is after sidekiq process is killed, it should also restart the process. Here is what sudo monit status gives me after sidekiq is killed

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

I also get mail stating "Execution Failed".
Why am I getting execution failed error and why process is not being restarted by monit?

Umesh Malhotra
  • 967
  • 1
  • 10
  • 25
  • when the process is killed, can you confirm if the pid in the file is deleted `tmp/pids/sidekiq_development.pid` ? – Kedarnag Mukanahallipatna Aug 13 '18 at 07:22
  • No, the file is not removed, it still contains pid (in this case- 10951), although I do get the mail "monit alert- Does not exist Service sidekiq_process" – Umesh Malhotra Aug 13 '18 at 07:26
  • I have not used Monit myself, can you take a look at [read_the_last_comment](https://github.com/mperham/sidekiq/issues/3679) and [this](https://stackoverflow.com/questions/13433866/monit-ruby-on-rails-sidekiq) – Kedarnag Mukanahallipatna Aug 13 '18 at 07:31

1 Answers1

1

wrap your exec command in a shell script and chmod +x it, and check my answer here

Viktova
  • 552
  • 7
  • 19