Created
February 4, 2009 10:08
-
-
Save calas/58047 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :monit do | |
namespace :debian do | |
desc <<-DESC | |
Install monit. | |
"Source":#{link_to_source(__FILE__)} | |
DESC | |
task_arg(:monit_port, "Monit port", :default => 2812) | |
task_arg(:monit_password, "Monit password") | |
task_arg(:monit_conf_dir, :default => "/etc/monit") | |
task_arg(:monit_build_options, <<-EOS) | |
Monit build options | |
<pre> | |
<code class="ruby"> | |
set :monit_build_options, { :url => "http://www.tildeslash.com/monit/dist/monit-4.10.1.tar.gz" } | |
</code> | |
</pre> | |
EOS | |
task :install do | |
# Install dependencies | |
wajig.install([ "flex", "byacc" ]) | |
# Build | |
build.make_install("monit", monit_build_options) | |
# Install initscript | |
utils.install_template("monit/monit.initd.debian.erb", "/etc/init.d/monit") | |
# Install monitrc | |
run_via "mkdir -p /etc/monit" | |
utils.install_template("monit/monitrc.erb", "/etc/monitrc", :user => "root", :mode => "700") | |
utils.install_template("monit/system.monitrc", "/etc/monit/system.monitrc", :user => "root", :mode => "700") | |
# TODO: Implement ssl cert with variables | |
# Install to inittab | |
utils.append_to("/etc/inittab", <<-APPEND, "^mo:345:respawn:/usr/local/bin/monit") | |
# Run monit in standard run-levels | |
mo:345:respawn:/usr/local/bin/monit -Ic /etc/monitrc -p /var/run/monit.pid | |
APPEND | |
# HUP the inittab | |
run_via "update-rc.d monit defaults" | |
run_via "/etc/init.d/monit restart" | |
run_via "telinit q" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment