Skip to content

Commit

Permalink
Add a monit recipe to monitor and restart riak, for use in conjunctio…
Browse files Browse the repository at this point in the history
…n with the monit cookbook. Monit implementation has its own recipe, so it will not affect any nodes that do not specifically add it to their run list.
  • Loading branch information
freerobby committed Aug 8, 2012
1 parent 1769655 commit 242f49b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions attributes/monit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default.riak.monit.process_matching = "/usr/lib/riak/erts-5.8.5/bin/beam.smp"
default.riak.monit.start_program = "/usr/sbin/riak"
default.riak.monit.http_host = "localhost"
default.riak.monit.http_port = "8098"
14 changes: 14 additions & 0 deletions recipes/monit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This is an optional recipe that provides monit monitoring of your riak node. Requires the monit cookbook.

include_recipe "monit::default"

monitrc "riak" do
variables(
:process_matching => node[:riak][:monit][:process_matching],
:start_program => node[:riak][:monit][:start_program],
:http_host => node[:riak][:monit][:http_host],
:http_port => node[:riak][:monit][:http_port]
)
template_source "riak-monit.conf.erb"
template_cookbook "riak"
end
7 changes: 7 additions & 0 deletions templates/default/riak-monit.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
check process riak matching "<%= @process_matching %>"
group riak
start program = "<%= @start_program %>"
if failed host <%= @http_host %> port <%= @http_port %> protocol http
and request "/"
with timeout 2 seconds for 2 cycles
then restart

0 comments on commit 242f49b

Please sign in to comment.