0

I have monit configured to monitor a job for the production version of my application:

# in /etc/monitrc:
include /etc/monit/delayed_job.my_app.production.monitrc

# in /etc/monit/delayed_job.my_app.production.monitrc
check process delayed_job with pidfile /var/www/apps/myapp_production/shared/pids/delayed_job.pid
start program = "/var/www/apps/myapp_production/current/script/delayed_job -e production start"
stop program = "/var/www/apps/myapp_production/current/script/delayed_job -e production stop"

I'd like to also monitor the staging version on the same box, but I can't quite figure out whether what I want to do is allowed. My first guess was just to do a gsub/production/staging:

# in /etc/monitrc:
include /etc/monit/delayed_job.my_app.staging.monitrc

# in /etc/monit/delayed_job.my_app.staging.monitrc:
check process delayed_job with pidfile /var/www/apps/myapp_staging/shared/pids/delayed_job.pid
start program = "/var/www/apps/myapp_staging/current/script/delayed_job -e staging start"
stop program = "/var/www/apps/myapp_staging/current/script/delayed_job -e staging stop"

But now I have two processes named "delayed_job." How can I tell monit which one to start and stop? I want to be able to do something like

monit start delayed_job.production

but I think that process name has to be the actual name of the process, which is determined by the script name.

James A. Rosen
  • 503
  • 3
  • 9
  • 19

1 Answers1

2

I don't know monit (never used it in fact). Maybe I'm a little bit naive but if you are already passing the process pid in a file, there is no reason for it to use your process name.

That would lead to a declaration as simple as:

check process delayed_job.production with pidfile ...

Did you already give it a try?

rolaf
  • 558
  • 1
  • 3
  • 8