Last active
December 23, 2015 04:59
-
-
Save tdantas/6584182 to your computer and use it in GitHub Desktop.
Monitoring with monit recipes
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
check system localhost | |
if loadavg (1min) > 8 then alert | |
if loadavg (5min) > 4 then alert | |
if memory usage > 75% then alert | |
if cpu usage (user) > 70% for 8 cycles then alert | |
if cpu usage (system) > 40% for 8 cycles then alert | |
if cpu usage (wait) > 20% for 8 cycles then alert | |
check process apache with pidfile /var/run/apache2.pid | |
start program = "/etc/init.d/apache2 start" | |
stop program = "/etc/init.d/apache2 stop" | |
if cpu > 60% for 3 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if totalmem > 400.0 MB for 5 cycles then restart | |
if children > 250 then restart | |
if loadavg(5min) greater than 20 for 8 cycles then alert | |
group server | |
check process redis | |
with pidfile /home/ubuntu/public_html/mylinkedcare/shared/pids/redis.pid | |
start program = "/usr/bin/redis-server /etc/redis/redis.conf" | |
stop program = "/usr/bin/redis-cli shutdown" | |
if failed host 127.0.0.1 port 6379 then restart | |
if 5 restarts within 5 cycles then timeout | |
check file dump.rdb with path /var/lib/redis/dump.rdb | |
if size > 100 MB then alert | |
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 failed host 127.0.0.1 port 80 then restart | |
if cpu is greater than 40% for 2 cycles then alert | |
if cpu > 60% for 5 cycles then restart | |
if 10 restarts within 10 cycles then timeout | |
check process mysqld with pidfile /var/lib/mysql/ns388683.pid | |
group database | |
start program = "/etc/init.d/mysql start" | |
stop program = "/etc/init.d/mysql stop" | |
if failed host 127.0.0.1 port 3306 then restart | |
if 5 restarts within 5 cycles then timeout | |
check process postgresql with pidfile /var/run/postgresql/p.pid | |
start program = “/etc/init.d/postgresql start” | |
stop program = “/etc/init.d/postgresql stop” | |
if failed unixsocket /var/run/postgresql/.s.PGSQL.5432 protocol pgsql then restart | |
if failed unixsocket /var/run/postgresql/.s.PGSQL.5432 protocol pgsql then alert | |
if failed host localhost port 5432 protocol pgsql then restart | |
if failed host localhost port 5432 protocol pgsql then alert | |
if 5 restarts within 5 cycles then timeout | |
check process sidekiq | |
with pidfile /path/to/sidekiq.pid | |
start program = "bundle exec sidekiq -C /path/to/sidekiq_conf.yml -P /path/to/sidekiq.pid" with timeout 90 seconds | |
stop program = "kill -s TERM `cat /path/to/sidekiq.pid`" with timeout 90 seconds | |
if totalmem is greater than 500 MB for 2 cycles then restart # eating up memory? | |
group sidekiq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment