Provides a set of primitives for managing monit and associated monit configurations.
PLEASE NOTE - The resource/providers in this cookbook are under heavy development. An attempt is being made to keep the resource simple/stupid by starting with less sophisticated firewall implementations first and refactor/vet the resource definition with each successive provider.
0.10.10 but newer versions should work just fine.
- Ubuntu 11.04
- Ubuntu 12.04
but older and newer platforms should work just fine.
Some monit configuration recipes have been provided for some popular services.
Installs monit as a service using the package manager and drops off a
monitrc configuration file. Make sure to check out the default attributes file!
monit resource is provided to easily manage monit configurations. Here's a simple example
monit "postgresql" do pidfile "/var/run/postgresql/9.1-main.pid" start "/etc/init.d/postgresql start" stop "/etc/init.d/postgresql stop" end
Default action is
:enable. You can disable by doing
monit "postgresql" do ... action :disable end
What happens if you want to run the process as a user? The
monit resource provides a helper attribute
as and will load that user's environment while running the
monit "sidekiq" do pidfile "/app/pids/sidekiq.pid" start "/app/bin/sidekiq --pidfile /app/pids/sidekiq.pid" as "deployer" conditions [ "if mem > 256 MB for 1 cycles then restart", "if cpu > 90% for 5 cycles then restart", "if 5 restarts within 5 cycles then timeout" ] end
You still have the option to run the commands directly as the user (without environment) with
gid, although most likely you will want to use
monit "sidekiq" do ... uid "deployer" gid "admin" ... end
Notice that in the above example,
stop is not set. If
stop is not set, the provider will use a
SIGTERM to kill the pid in the
No pidfile?. No worries bro!
monit "varnish" do matching "varnishd" ... end
Author:: James Hu (email@example.com)
Copyright:: Copyright (c) 2012, James Hu
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.