Skip to content

Commit

Permalink
Merge pull request #39 from shareaholic/riak_monit
Browse files Browse the repository at this point in the history
Add a monit recipe to monitor and restart riak, for use in conjunction with the monit cookbook
  • Loading branch information
Seth Thomas committed Mar 25, 2013
2 parents 09e118d + 242f49b commit 26aae0b
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 26aae0b

Please sign in to comment.