Monit Default Limits
The gem creates a default monit configuration for your application that tries to keep it within sensible limits. You can edit these limits if you find your application breaches them regularly within normal operation.
- restart if the mongrel memory usage exceeds 110Mb for 3 checks.
- restart if the mongrel cpu usage exceeds 80% for 5 checks.
- unmonitor application if constantly restarting.
- restart if the application fails to respond to within 30 seconds.
Note that the way monit checks whether an application is responding is to open an HTTP connection to the application root (ie URL http://localhost/), and it expects to see a 200 OK response. If you redirect the root (30x) or issue a 'not found' (404) then monit will restart the application.
Changing monit defaults
There are several variables available to change how monit checks your application.
URL to check application is working
You can include slugs, paths and username/passwords as required. Generally the host should always remain 'localhost'.
set :mongrel_check_url, "http://user:password@localhost/path/to/check"
The amount of memory a mongrel is using
set :mongrel_max_memory, 110
The amount is in megabytes
The amount of CPU a mongrel is using
set :mongrel_max_cpu, 80
The amount is a percentage.
Activating the new settings
If you change the monit settings, you need to update the setup and reload the monit configuration.
cap deploy:setup cap deploy:monit:reload