Last active
March 27, 2017 17:41
-
-
Save EugeneKey/b491fbf755ddfd520756 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Unicorn ### | |
check process unicorn | |
with pidfile "/home/deployer/qna/current/tmp/pids/unicorn.pid" | |
start program = "/bin/su - deployer -c 'cd /home/deployer/qna/current && ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec unicorn -c /home/deployer/qna/current/config/unicorn/production.rb -E deployment -D )'" | |
stop program = "/bin/su - deployer -c 'cd /home/deployer/qna/current && /usr/bin/env kill -s QUIT `cat /home/deployer/qna/current/tmp/pids/unicorn.pid`'" | |
if memory usage > 90% for 3 cycles then restart | |
if cpu > 90% for 2 cycles then restart | |
if 5 restarts within 5 cycles then timeout | |
### Puma ### | |
check process puma | |
with pidfile "/home/ubuntu/qna/shared/tmp/pids/puma.pid" | |
start program = "/bin/su - ubuntu -c 'cd /home/ubuntu/qna/current && ~/.rvm/bin/rvm default do bundle exec puma -C /home/ubuntu/qna/shared/puma.rb --daemon'" | |
stop program = "/bin/su - ubuntu -c 'cd /home/ubuntu/qna/current && ~/.rvm/bin/rvm default do bundle exec pumactl -S /home/ubuntu/qna/shared/tmp/pids/puma.state stop'" | |
if cpu > 80% then restart | |
if memory usage > 80% for 2 cycles then restart | |
if 3 restarts within 3 cycles then timeout | |
### Nginx Passanger ### | |
check process nginx | |
with pidfile /opt/nginx/logs/nginx.pid | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if memory usage > 80% for 5 cycles then restart | |
if failed host 127.0.0.1 port 80 protocol http then restart | |
if 3 restarts within 5 cycles then timeout | |
### Nginx ### | |
check process nginx with pidfile /var/run/nginx.pid | |
group www | |
group nginx | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if memory usage > 80% for 5 cycles then restart | |
if failed port 80 protocol http request "/" then restart | |
if 5 restarts with 5 cycles then timeout | |
depend nginx_bin | |
depend nginx_rc | |
check file nginx_bin with path /usr/sbin/nginx | |
group nginx | |
include /etc/monit/templates/rootbin | |
check file nginx_rc with path /etc/init.d/nginx | |
group nginx | |
include /etc/monit/templates/rootbin | |
### Postgresql ### | |
check process postgresql | |
with pidfile "/var/run/postgresql/9.3-main.pid" | |
start program = "/usr/sbin/service postgresql start" | |
stop program = "/usr/sbin/service postgresql stop" | |
if failed host localhost port 5432 protocol pgsql then restart | |
if cpu > 80% then restart | |
if memory usage > 80% for 2 cycles then restart | |
if 5 restarts within 5 cycles then timeout | |
### Redis ### | |
check process redis-server | |
with pidfile "/var/run/redis/redis-server.pid" | |
start program = "/etc/init.d/redis-server start" | |
stop program = "/etc/init.d/redis-server stop" | |
if totalmem > 100 Mb then alert | |
if children > 255 for 5 cycles then stop | |
if cpu usage > 95% for 3 cycles then restart | |
if memory usage > 80% for 5 cycles then restart | |
if failed host 127.0.0.1 port 6379 then restart | |
if 5 restarts within 5 cycles then timeout | |
### Sidekiq ### | |
check process sidekiq | |
with pidfile "/home/ubuntu/qna/shared/tmp/pids/sidekiq-0.pid" | |
start program = "/bin/su - ubuntu -c 'cd /home/ubuntu/qna/current && ~/.rvm/bin/rvm default do bundle exec sidekiq --index 0 --pidfile /home/ubuntu/qna/shared/tmp/pids/sidekiq-0.pid --environment production --logfile /home/ubuntu/qna/shared/log/sidekiq.log --queue default --queue mailers -d'" with timeout 30 seconds | |
stop program = "/bin/su - ubuntu -c 'cd /home/ubuntu/qna/current && ~/.rvm/bin/rvm default do bundle exec sidekiqctl stop /home/ubuntu/qna/shared/tmp/pids/sidekiq-0.pid'" with timeout 20 seconds | |
if cpu > 80% then restart | |
if memory usage > 80% for 2 cycles then restart | |
if 3 restarts within 3 cycles then timeout | |
### Sphinx ### | |
check process sphinx | |
with pidfile "/home/deployer/qna/shared/log/production.sphinx.pid" | |
start program = "/bin/su - deployer -c 'cd /home/deployer/qna/current && /home/deployer/.rvm/bin/rvm default do bundle exec rake RAILS_ENV=production ts:start'" | |
stop program = "/bin/su - deployer -c 'cd /home/deployer/qna/current && /home/deployer/.rvm/bin/rvm default do bundle exec rake RAILS_ENV=production ts:stop'" | |
if cpu > 80% then restart | |
if memory usage > 80% for 2 cycles then restart | |
if 3 restarts within 3 cycles then timeout | |
### Thin (private_pub) ### | |
check process thin | |
with pidfile "/home/deployer/qna/shared/tmp/pids/thin.pid" | |
start program = "/bin/su - deployer -c 'cd /home/deployer/qna/current && RAILS_ENV=production /home/deployer/.rvm/bin/rvm default do bundle exec thin -C config/private_pub_thin.yml start'" | |
stop program = "/bin/su - deployer -c 'cd /home/deployer/qna/current && RAILS_ENV=production /home/deployer/.rvm/bin/rvm default do bundle exec thin -C config/private_pub_thin.yml stop'" | |
if cpu > 80% then restart | |
if memory usage > 80% for 2 cycles then restart | |
if 3 restarts within 3 cycles then timeout | |
### Puma (private_pub) ### | |
check process private_pub | |
with pidfile "/home/ubuntu/qna/shared/tmp/pids/puma_private_pub.pid" | |
start program = "/bin/su - ubuntu -c 'cd /home/ubuntu/qna/current && RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec pumactl -F /home/ubuntu/qna/shared/config/private_pub_puma.rb start'" | |
stop program = "/bin/su - ubuntu -c 'cd /home/ubuntu/qna/current && RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec pumactl -F /home/ubuntu/qna/shared/config/private_pub_puma.rb stop'" | |
if cpu > 80% then restart | |
if memory usage > 80% for 2 cycles then restart | |
if 3 restarts within 3 cycles then timeout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment