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


monit_wrapper (31) Versions 3.2.1

A wrapper around Monit making it easier to monitor services

cookbook 'monit_wrapper', '= 3.2.1', :supermarket
cookbook 'monit_wrapper', '= 3.2.1'
knife supermarket install monit_wrapper
knife supermarket download monit_wrapper
Quality 0%


Build Status

This cookbook simplifies setting up services using Monit.


Custom Monit configuration template

Create a configuration template in your cookbook my_cookbook/templates/default/monit/my_service.conf.erb:

check process <%= @service_name %>
  matching '<%= @cmd_line_pattern %>'
  every 1 cycles
  start program "/bin/bash -c 'exec <%= @cmd_line %>'"
    as uid <%= @user %> as gid <%= @user %>
  stop program "/usr/bin/pkill -u <%= @user %> -f '<%= @cmd_line_pattern %>'"
    as uid <%= @user %> as gid <%= @user %>

In my_cookbook/recipes/default.rb:

my_service_name = '...'
command_line = '/usr/local/bin/my_service_executable --port 3456'

monit_wrapper_monitor my_service_name do
  template_cookbook 'my_cookbook'
  template_source 'monit/my_service.conf.erb'
  variables cmd_line: command_line,
            cmd_line_pattern: command_line,
            user: user

monit_wrapper_notify_if_not_running monit_service_name

monit_wrapper_service my_service_name do
  subscribes :restart, "monit_wrapper_monitor[#{my_service_name}]", :delayed
  subscribes :restart, "monit_wrapper_notify_if_not_running[#{my_service_name}]", :delayed
  subscribes :restart, "package[#{my_service_name}]", :delayed

Launching and monitoring a process with an existing init

If you have a service with an existing /etc/init.d script, you can use this cookbook to create
a Monit configuration file to monitor that service. This makes use of the default Monit
configuration template

this cookbook provides.

my_sevice_name = 'my-service'

monit_wrapper_monitor my_service_name do
  action :create
  pattern '...'

monit_wrapper_notify_if_not_running my_service_name do

monit_wrapper_service service_name do
  subscribes :restart, "package[#{service_name}]", :delayed
  subscribes :restart, "monit_wrapper_monitor[#{service_name}]", :delayed
  subscribes :restart, "monit_wrapper_notify_if_not_running[#{service_name}]",


Apache License 2.0

Foodcritic Metric

3.2.1 failed this metric

FC002: Avoid string interpolation where not required: /tmp/cook/1fcf962255b2fc638cfc26e3/monit_wrapper/libraries/status.rb:125
FC014: Consider extracting long ruby_block to library: /tmp/cook/1fcf962255b2fc638cfc26e3/monit_wrapper/providers/reload_and_wait.rb:23
FC031: Cookbook without metadata file: /tmp/cook/1fcf962255b2fc638cfc26e3/monit_wrapper/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/1fcf962255b2fc638cfc26e3/monit_wrapper/metadata.rb:1