Skip to content

Example Monit Config

Pistos edited this page Aug 21, 2012 · 1 revision
check process libertree-frontend-ramaze
    with pidfile /home/libertree/git/libertree-frontend-ramaze/pids/unicorn.pid
    start program = "/bin/bash -c 'cd /home/libertree/git/libertree-frontend-ramaze && LANG=en_GB.UTF-8 GEM_HOME=/home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-frontend-ramaze PATH=/home/libertree/.rvm/rubies/ruby-1.9.3-p125/bin:/usr/bin:/usr/local/bin LIBERTREE_ENV=production /home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-frontend-ramaze/bin/bundle exec unicorn -D -c unicorn.conf'"
        as uid libertree and gid libertree
    stop program = "/bin/bash -c 'kill -s TERM `cat /home/libertree/git/libertree-frontend-ramaze/pids/unicorn.pid`'"
        as uid libertree and gid libertree
    if cpu > 90% for 5 cycles then restart
    if totalmem > 192.0 MB for 5 cycles then restart

check process libertree-frontend-websocket
    with pidfile /home/libertree/git/libertree-frontend-ramaze/pids/websocket-server.pid
    start program = "/bin/bash -c 'cd /home/libertree/git/libertree-frontend-ramaze && GEM_HOME=/home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-frontend-ramaze PATH=/home/libertree/.rvm/rubies/ruby-1.9.3-p125/bin:/usr/bin:/usr/local/bin LIBERTREE_ENV=production /home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-frontend-ramaze/bin/bundle exec ruby websocket-server.rb'"
        as uid libertree and gid libertree
    stop program = "/bin/bash -c 'kill -s TERM `cat /home/libertree/git/libertree-frontend-ramaze/pids/websocket-server.pid`'"
        as uid libertree and gid libertree
    if cpu > 90% for 5 cycles then restart
    if totalmem > 64.0 MB for 5 cycles then restart

check process libertree-backend-job-processor
    with pidfile /home/libertree/git/libertree-backend-rb/pids/job-processor.pid
    start program = "/bin/bash -c 'cd /home/libertree/git/libertree-backend-rb && GEM_HOME=/home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-backend-rb PATH=/home/libertree/.rvm/rubies/ruby-1.9.3-p125/bin:/usr/bin:/usr/local/bin LIBERTREE_ENV=production /home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-backend-rb/bin/bundle exec ruby bin/job-processor.rb config.yaml'"
        as uid libertree and gid libertree
    stop program = "/bin/bash -c 'kill -s TERM `cat /home/libertree/git/libertree-backend-rb/pids/job-processor.pid`'"
        as uid libertree and gid libertree
    if cpu > 90% for 5 cycles then restart
    if totalmem > 64.0 MB for 5 cycles then restart

check process libertree-frontend-job-processor
    with pidfile /home/libertree/git/libertree-frontend-ramaze/pids/job-processor.pid
    start program = "/bin/bash -c 'cd /home/libertree/git/libertree-frontend-ramaze && GEM_HOME=/home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-frontend-ramaze PATH=/home/libertree/.rvm/rubies/ruby-1.9.3-p125/bin:/usr/bin:/usr/local/bin LIBERTREE_ENV=production /home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-frontend-ramaze/bin/bundle exec ruby job-processor.rb config/job-processor.yaml'"
        as uid libertree and gid libertree
    stop program = "/bin/bash -c 'kill -s TERM `cat /home/libertree/git/libertree-frontend-ramaze/pids/job-processor.pid`'"
        as uid libertree and gid libertree
    if cpu > 90% for 5 cycles then restart
    if totalmem > 64.0 MB for 5 cycles then restart

check process libertree-backend-server
    with pidfile /home/libertree/git/libertree-backend-rb/pids/server.pid
    start program = "/bin/bash -c 'cd /home/libertree/git/libertree-backend-rb && GEM_HOME=/home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-backend-rb PATH=/home/libertree/.rvm/rubies/ruby-1.9.3-p125/bin:/usr/bin:/usr/local/bin LIBERTREE_ENV=production /home/libertree/.rvm/gems/ruby-1.9.3-p125@libertree-backend-rb/bin/bundle exec ruby -Ilib bin/server.rb config.yaml'"
        as uid libertree and gid libertree
    stop program = "/bin/bash -c 'kill -s TERM `cat /home/libertree/git/libertree-backend-rb/pids/server.pid`'"
        as uid libertree and gid libertree
    if cpu > 90% for 5 cycles then restart
    if totalmem > 64.0 MB for 5 cycles then restart
Clone this wiki locally