Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

monit-ng (31) Versions 1.2.0

Installs and configures monit

Policyfile
Berkshelf
Knife
cookbook 'monit-ng', '= 1.2.0', :supermarket
cookbook 'monit-ng', '= 1.2.0'
knife supermarket install monit-ng
knife supermarket download monit-ng
README
Dependencies
Changelog
Quality 0%

Chef monit cookbook

Installs and configures monit, with a resource
provider for managing additional monit checks.

Recipes

  • monit::default: installs and optionally configures monit
  • monit::repo: installs monit from a package repository
  • monit::source: installs monit from source
  • monit::config: configures monit
  • monit::{crond,ntpd,postfix,rsyslog,snmpd,sshd}: install common service checks

Attributes

monit_check resource examples

External Service Check
monit_check 'facebook_api' do
  check_type  'host'
  check_id    'api.facebook.com'
  group       'external'
  tests [
    {
      'condition' => 'failed port 80 proto http',
      'action'    => 'alert'
    },
    {
      'condition' => 'failed port 443 type tcpSSL proto http',
      'action'    => 'alert'
    },
  ]
end
SSHD
monit_check 'sshd' do
  check_id  '/var/run/sshd.pid'
  group     'system'
  start     '/etc/init.d/ssh start'
  stop      '/etc/init.d/ssh stop'
  tests [
    {
      'condition' => "failed port #{node.openssh.server.port} proto ssh for 3 cycles",
      'action'    => 'restart'
    },
    {
      'condition' => '3 restarts within 5 cycles',
      'action'    => 'alert'
    },
  ]
end
Postfix
monit_check 'postfix' do
  check_id  '/var/spool/postfix/pid/master.pid'
  group     'system'
  start     '/etc/init.d/postfix start'
  stop      '/etc/init.d/postfix stop'
  tests [
    {
      'condition' => 'failed port 25 proto smtp',
      'action'    => 'restart'
    },
    {
      'condition' => '3 restarts within 5 cycles',
      'action'    => 'alert'
    },
  ]
end
Nginx
monit_check 'nginx' do
  check_id  '/var/run/nginx.pid'
  group     'app'
  start     '/etc/init.d/nginx start'
  stop      '/etc/init.d/nginx stop'
  tests [
    {
      'condition' => 'failed port 80',
      'action'    => 'restart'
    },
    {
      'condition' => '3 restarts within 5 cycles',
      'action'    => 'alert'
    }
  ]
end
Memcache
monit_check 'memcache' do
  check_id  '/var/run/memcached.pid'
  group     'app'
  start     '/etc/init.d/memcached start'
  stop      '/etc/init.d/memcached stop'
  tests [
    {
      'condition' => 'failed port 11211 proto memcache',
      'action'    => 'restart'
    },
    {
      'condition' => '3 restarts within 15 cycles',
      'action'    => 'alert'
    },
  ]
end
Redis
monit_check 'redis' do
  check_id  '/var/run/redis/redis-server.pid'
  group     'database'
  start     '/etc/init.d/redis-server start'
  stop      '/etc/init.d/redis-server stop'
  tests [
    {
      'condition' => 'failed host 127.0.0.1 port 6379 
                     send "SET MONIT-TEST value\r\n" expect "OK" 
                     send "EXISTS MONIT-TEST\r\n" expect ":1"',
      'action'    => 'restart'
    },
    {
      'condition' => '3 restarts within 5 cycles',
      'action'    => 'alert'
    },
  ]
end
Solr
monit_check 'solr' do
  check_id  '/var/run/tomcat6.pid'
  group     'app'
  start     '/etc/init.d/tomcat6 start'
  stop      '/etc/init.d/tomcat6 stop'
  tests [
    {
      'condition' => 'failed port 8080 proto http and request "/solr/admin/ping" for 2 cycles',
      'action'    => 'restart'
    },
    {
      'condition' => '3 restarts within 5 cycles',
      'action'    => 'timeout'
    },
  ]
end
MongoDB
monit_check 'mongo' do
  check_id  "#{node.mongodb.dbpath}/mongod.lock"
  group     'database'
  start     '/etc/init.d/mongodb start'
  stop      '/etc/init.d/mongodb stop'
  tests [
    {
      'condition' => "failed port #{node.mongodb.port} proto http for 2 cycles",
      'action'    => 'restart with timeout 60 seconds'
    },
    {
      'condition' => 'if 3 restarts within 10 cycles',
      'action'    => 'timeout'
    },
  ]
end

1.2.0 / 2014-10-23

  • prefer upstart init on ubuntu >= 12.04
  • prefer systemd init on centos >= 7.0
  • unwind sysv init on upstart/systemd platforms to help migrate from pre-1.2.0 cookbook (to be removed in 1.3)
  • spec updates for serverspec 2.0
  • bug-fix: correct LSB headers in sysv script to fix debian support
  • add debian to test platforms
  • use cookbook_name when loading our own recipes

1.1.5 / 2014-10-11

  • update check_pairs to support multiple id_types for a check (thanks @vkhatri!)
  • add matching id_type for process checks (thanks @vkhatri!)

1.1.4 / 2014-09-10

  • add start config for /etc/default/monit in Ubuntu 14.04 (thanks @kevit!)

1.1.3 / 2014-09-05

  • update source install to 5.8.1

1.1.2 / 2014-09-05

  • rename to monit-ng

1.1.0 / 2014-04-26

  • fix default overriding instance args

1.0.2 / 2014-04-26

  • code cleanup
  • cleaner attributes

1.0.0 / 2014-04-25

  • release version 1.0.0

Foodcritic Metric
            

1.2.0 failed this metric

FC004: Use a service resource to start and stop services: /tmp/cook/20676b88ff69d2ddd8afdc38/monit-ng/recipes/source.rb:125
FC014: Consider extracting long ruby_block to library: /tmp/cook/20676b88ff69d2ddd8afdc38/monit-ng/recipes/source.rb:148