I'm trying to use monit to monitor a backgroundrb process (that gets killed occasionally), but I cant seem to seem the start or stop commands to work (i simply get 'execution failed') - though they do work fine from the command prompt.
I'm not doing anything particularly sophisticated:
check process backgroundrb_11006 with pidfile "/home/user/site/tmp/pids/backgroundrb_11006.pid" start = "/usr/bin/ruby /home/user/site/script/backgroundrb start" stop = "/usr/bin/ruby /home/user/site/script/backgroundrb stop" if cpu > 90% for 2 cycles then restart if totalmem > 512 MB for 2 cycles then restart if 4 restarts within 4 cycles then timeout group backgroundrb
I have a custom location for my some of my gems like packet (/home/user/.gem/ruby/1.8/bin), and I suspect that part of the problem is that monit uses a spartan PATH (To quote http://mmonit.com/monit/documentation/monit.html - PATH=/bin:/usr/bin:/sbin:/usr/sbin), rendering these gems unreachable. Also, I get no errors in the backgroundrb debug log.
I'd love to hear from anyone who has any idea how I might adjust backgroundrb (or my start/stop commands) in order to make this work.