Created
March 23, 2018 15:06
-
-
Save vikkanaev/6b4fbbef5c931b4479c756f3dc205f3f to your computer and use it in GitHub Desktop.
Проверка работоспособности сервисов проекта ViksTnetica17 через Monit
This file contains 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
### Nginx ### | |
check process nginx with pidfile /run/nginx.pid | |
start program = "/usr/sbin/service nginx start" | |
stop program = "/usr/sbin/service 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 443 protocol https | |
then restart | |
if 3 restarts within 5 cycles then timeout | |
### Postgresql ### | |
check process postgresql | |
with pidfile "/var/run/postgresql/9.5-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_6379.pid" | |
start program = "/etc/init.d/redis_6379 start" | |
stop program = "/etc/init.d/redis_6379 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/deploy/ViksTnetica17/shared/tmp/pids/sidekiq-0.pid" | |
start program = "/bin/su - deploy -c 'cd /home/deploy/ViksTnetica17/current && /usr/local/rvm/bin/rvm default do bundle exec sidekiq --index 0 --pidfile /home/deploy/ViksTnetica17/shared/tmp/pids/sidekiq-0.pid --environment production --logfile /home/deploy/ViksTnetica17/shared/log/sidekiq.log --queue mailers --daemon'" | |
stop program = "/bin/su - deploy -c 'cd /home/deploy/ViksTnetica17/current && /usr/local/rvm/bin/rvm default do bundle exec sidekiqctl stop /home/deploy/ViksTnetica17/shared/tmp/pids/sidekiq-0.pid 10'" | |
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/deploy/ViksTnetica17/shared/log/production.sphinx.pid" | |
start program = "/bin/su - deploy -c 'cd /home/deploy/ViksTnetica17/current && ( export RAILS_ENV="production" ; /usr/local/rvm/bin/rvm default do bundle exec rake ts:start )'" | |
stop program = "/bin/su - deploy -c 'cd /home/deploy/ViksTnetica17/current && ( export RAILS_ENV="production" ; /usr/local/rvm/bin/rvm default do bundle exec rake ts:stop )'" | |
if cpu > 80% then restart | |
if memory usage > 80% for 2 cycles then restart | |
if 3 restarts within 3 cycles then timeout | |
### Unicorn ### | |
check process unicorn | |
with pidfile "/home/deploy/ViksTnetica17/shared/tmp/pids/unicorn.pid" | |
start program = "/bin/su - deploy -c 'cd /home/deploy/ViksTnetica17/current && ( export RAILS_ENV="production" ; /usr/local/rvm/bin/rvm default do bundle exec unicorn -c /home/deploy/ViksTnetica17/current/config/unicorn/production.rb -E deployment -D )'" | |
stop program = "/bin/su - deploy -c 'cd /home/deploy/ViksTnetica17/current && /usr/bin/env kill -s QUIT `cat /home/deploy/ViksTnetica17/current/tmp/pids/unicorn.pid`'" | |
if cpu > 90% for 2 cycles then restart | |
if memory usage > 90% for 3 cycles then restart | |
if 5 restarts within 5 cycles then timeout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment