Skip to content

Instantly share code, notes, and snippets.

@zxcvbnm4709 zxcvbnm4709/monitrc
Created Jun 25, 2012

Embed
What would you like to do?
Edit monit configuration file in /etc/monit/monitrc
set daemon 120
set logfile syslog facility log_daemon
set mailserver smtp.gmail.com port 587 username "user@domain.com" password "userpassword" using tlsv1,
with timeout 15 seconds
set eventqueue
basedir /var/monit
slots 1000
set mail-format { from: monit@mydomain.com }
set alert admin@domain.com
set httpd port 2812 and
allow admin:monit
check system localhost
if loadavg (1min) > 3 then alert
if loadavg (5min) > 2 then alert
if memory usage > 60% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
## nginx ##
check process nginx with pidfile /opt/nginx/logs/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
group server
## mysql ##
check process mysql with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
group database
## redis ##
check process redis-server with pidfile /var/run/redis.pid
start program = "/usr/bin/redis-server /etc/redis.conf"
stop program = "/usr/bin/killall -9 redis-server"
group redis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.