Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 3f5ac4e1b2
Fetching contributors…

Cannot retrieve contributors at this time

126 lines (85 sloc) 3.531 kb

chef-monit Build Status Code Climate

Description

Installs the monit package from (http://mmonit.com/monit/).

Requirements

Supported Platforms

The following platforms are supported by this cookbook, meaning that the recipes run on these platforms without error:

  • Ubuntu
  • Debian
  • RedHat
  • CentOS
  • Scientific
  • Fedora
  • SUSE
  • Amazon

Recipes

  • monit - The default recipe. Sets up the service definition and default checks.

Resources

monit_monitrc

The following will create a monitrc configuration:

monit_monitrc "ssh" do
  variables({ category: "system" })
end

The name parameter must match a file located in your templates directory. In the example above, this would be ssh.monitrc.erb.

The custom_variables option within the block is optional, and can contain a list of key-value pairs to assign within your template.

Usage

This cookbook installs the monit components if not present, and pulls updates if they are installed on the system.

Attributes

# How frequently the monit daemon polls for changes.
default["monit"]["polling_frequency"] = 20

# Use syslog for logging instead of a logfile.
default["monit"]["use_syslog"]        = true

# If not using syslog, the log file that monit will use.
default["monit"]["logfile"]           = "/var/log/monit.log"

# Email address that will be notified of events.
default["monit"]["alert_email"]       = "root@localhost"

# Enable the web interface and define credentials.
default["monit"]["web_interface"] = {
  :enable  => true,
  :port    => 2812,
  :address => "localhost",
  :allow   => ["localhost", "admin:b1gbr0th3r"]
}

# Email settings that will be used for notification of events.
default["monit"]["mail"] = {
  :hostname => "localhost",
  :port     => 25,
  :username => nil,
  :password => nil,
  :from     => "monit@$HOST",
  :subject  => "$SERVICE $EVENT at $DATE",
  :message  => "Monit $ACTION $SERVICE at $DATE on $HOST,\n\nDutifully,\nMonit",
  :tls      => false,
  :timeout  => 30
}

case platform
when "redhat", "centos", "fedora"
  default["monit"]["main_config_path"] = "/etc/monit.conf"
  default["monit"]["includes_dir"]     = "/etc/monit.d"
else
  default["monit"]["main_config_path"] = "/etc/monit/monitrc"
  default["monit"]["includes_dir"]     = "/etc/monit/conf.d"
end

Contributors

Many thanks go to the following contributors who have helped to make this cookbook even better:

  • @werdan
    • add support for redhat-flavored systems
  • @auser
    • add missing metadata
  • @arrowcircle
    • update syntax to be Ruby 1.8-compatible

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

chef-monit

Jump to Line
Something went wrong with that request. Please try again.