= Capistrano Monit Tasks
This library extends Capistrano to configure and control a *monit* daemon running on application servers.
It replaces some of the standard tasks with monit versions and includes tasks and helpers to create monit configuration files.
See below for instructions on downloading and configuring monit itself.
== Quick Start for cappy-monit
This assumes you're creating a fresh application install, not migrating an app from
spinner/spawner/reaper. It also assumes you have setup monit as shown above.
Install the package via gems or .tgz / .zip and setup.rb.
Include it in your deploy.rb with:
require "capistrano-monit/recipes"
Place at least the following directives in your deploy recipe:
set :mongrel_address, "127.0.0.1"
set :mongrel_servers, 2
set :mongrel_environment, "production"
set :mongrel_port, 9000
Then run:
* cap cold_deploy
This sets up one mongrel listener on port 8000 by default. Make sure your database is setup
and point your webserver at the new listener.
Deployment will create a monit configuration file for the mongrel processes in the shared/ directory.
Monit should be automatically configured to include this file.
== Usage
Capistrano Monit uses the same configuration directives as the Railsmachine mongrel_cluster gem. This means that you have
to define the mongrel settings in your deployment recipe.
Coming soon.
== Getting and setting up monit
Monit is a single-server monitoring and alerting package with a clean, natural configuration language. It runs as
a daemon, which also responds as an HTTP server, to control processes and to display their status.
The latest version of monit lives at: http://www.tildeslash.com/monit/download
The monit manual is thorough and recommended reading: http://www.tildeslash.com/monit/doc/manual.php
There are no complicated dependencies. Many operating systems include monit in its default package repositories (Debian, FreeBSD, CentOS).
Here is what a minimal monitrc file might look like:
# poll every 2 minutes (required)
set daemon 120
# log to syslog
set logfile syslog facility log_daemon
# use the defined mail servers for alerts (required)
set mailserver mail.example.com, localhost
#
set alert [email protected] # send alerts to this email address
# run the http server (required) with the defined user:pass
set httpd port 2812 and
allow admin:admin
# setup basic system checks and alerts
check system app-server-1
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
Place this file where you please (/etc/monit/monitrc for example). Running monit -c /etc/monit/monitrc should do the trick.
Some people prefer to run Monit directly from init. Please refer to the Monit manual for more information.
This library extends Capistrano to configure and control a *monit* daemon running on application servers.
It replaces some of the standard tasks with monit versions and includes tasks and helpers to create monit configuration files.
See below for instructions on downloading and configuring monit itself.
== Quick Start for cappy-monit
This assumes you're creating a fresh application install, not migrating an app from
spinner/spawner/reaper. It also assumes you have setup monit as shown above.
Install the package via gems or .tgz / .zip and setup.rb.
Include it in your deploy.rb with:
require "capistrano-monit/recipes"
Place at least the following directives in your deploy recipe:
set :mongrel_address, "127.0.0.1"
set :mongrel_servers, 2
set :mongrel_environment, "production"
set :mongrel_port, 9000
Then run:
* cap cold_deploy
This sets up one mongrel listener on port 8000 by default. Make sure your database is setup
and point your webserver at the new listener.
Deployment will create a monit configuration file for the mongrel processes in the shared/ directory.
Monit should be automatically configured to include this file.
== Usage
Capistrano Monit uses the same configuration directives as the Railsmachine mongrel_cluster gem. This means that you have
to define the mongrel settings in your deployment recipe.
Coming soon.
== Getting and setting up monit
Monit is a single-server monitoring and alerting package with a clean, natural configuration language. It runs as
a daemon, which also responds as an HTTP server, to control processes and to display their status.
The latest version of monit lives at: http://www.tildeslash.com/monit/download
The monit manual is thorough and recommended reading: http://www.tildeslash.com/monit/doc/manual.php
There are no complicated dependencies. Many operating systems include monit in its default package repositories (Debian, FreeBSD, CentOS).
Here is what a minimal monitrc file might look like:
# poll every 2 minutes (required)
set daemon 120
# log to syslog
set logfile syslog facility log_daemon
# use the defined mail servers for alerts (required)
set mailserver mail.example.com, localhost
#
set alert [email protected] # send alerts to this email address
# run the http server (required) with the defined user:pass
set httpd port 2812 and
allow admin:admin
# setup basic system checks and alerts
check system app-server-1
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
Place this file where you please (/etc/monit/monitrc for example). Running monit -c /etc/monit/monitrc should do the trick.
Some people prefer to run Monit directly from init. Please refer to the Monit manual for more information.