Skip to content

Instantly share code, notes, and snippets.

@crofty
Created September 9, 2009 11:35
Show Gist options
  • Save crofty/183664 to your computer and use it in GitHub Desktop.
Save crofty/183664 to your computer and use it in GitHub Desktop.
Monit installation and config on Slicehost
sudo apt-get install monit
# Edit config file, example below
sudo vim /etc/monit/monitrc
# Check config syntax
sudo monit -t
# When no syntax errors edit the /etc/default/monit file to startup=1
sudo vim /etc/default/monit
# Start the service with:
sudo /etc/init.d/monit start
### EXAMPLE CONFIG
set daemon 60
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from: monit@monitorserver.co.uk }
set alert alteremail@alert.com
check process httpd with pidfile /var/run/apache2.pid
group www-data
start program "/etc/init.d/apache2 start"
stop program "/etc/init.d/apache2 stop"
if failed host localhost port 80 protocol http
and request "/" then alert
if cpu is greater than 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then alert
if 3 restarts within 5 cycles then timeout
check file some_file.output with path /var/www/apps/app/shared/pids/some_file.output
if timestamp > 120 seconds then alert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment