Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
117 lines (77 sloc) 3.97 KB

monit_conf

monit_conf is a script that generates monit configuration file(s). It can generate monit configuration files from both thin and mongrel cluster configuration files.

Using monit_conf has the following benefits:

  • Easier to setup monit to correctly monitor thin and mongrel servers.
  • Uses a proven monit configuration file that handles mongrel crashes and stale pids correctly.

The script looks for thin and mongrel cluster configuration files (thin_cluster.conf and mongrel_cluster.yml) in the specified directory,
and generates one configuration file for every cluster configuration file it finds.

Install

	
git clone git://github.com/christianhellsten/monit_conf.git
cd monit_conf
rake install_gem
	

Requirements

Currently monit_conf assumes that you have thin_cluster.conf and/or mongrel_cluster.yml in RAILS_ROOT/config (can be a link).

Usage

To generate the monit configuration run the monit_conf command:

	
$ monit_conf 

  Searching for '{thin_cluster.conf,mongrel_cluster.yml}' in '/var/www/**/current/**'

	

As you can see the script will by default look for thin_cluster.conf and mongrel_cluster.yml files in /var/www//current/.

See the help documentation for details on how to change this behavior:

	
$ monit_conf  --help

Usage: monit_conf [OPTIONS]
    

Generates monit configuration file(s) from one or more thin/mongrel cluster configuration files.

The script searches for thin and mongrel cluster configuration files (thin_cluster.conf and mongrel_cluster.yml) in the specified directory, 
and generates a separate configuration file for each cluster configuration found.


Optional arguments:
      --input=[val]                Where to look for mongrel_cluster.yml files. Also see --mongrel_conf switch.
                                   Default: /var/www/**/current/**
      --output=[val]               Where monit configuration files will be written.
                                   Default: /etc/monit/include
      --pattern=[val]              Pattern that matches mongrel and/or thin configuration files (Dir.glob syntax).
                                   Default: {thin_cluster.conf,mongrel_cluster.yml}
      --template_dir=[val]         The directory where monit templates for thin and mongrel are found.
                                   Default: /usr/local/lib/ruby/gems/1.8/gems/monit_conf-x.x.x/templates/

  -h, --help                       Show this help message.

	

This command, for example, will look for mongrel_cluster.yml files in the home directory and write the monit files to /tmp:

	
monit_conf --input=/home/christian/** --output=/tmp
	

License

(The MIT License)

Copyright © 2008 FIXME full name

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
‘Software’), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Todo

  • Better group names
  • Better defaults (we’re assuming that the configuration files contains xyz at the moment)
  • Refactor

Author

Christian Hellsten (Aktagon Ltd.)

Something went wrong with that request. Please try again.