lib/capistrano-mon.rb in capistrano-mon-0.0.2 vs lib/capistrano-mon.rb in capistrano-mon-0.0.3

- old
+ new

@@ -9,10 +9,46 @@ configuration.load { namespace(:mon) { _cset(:mon_path, "/etc/mon") _cset(:mon_lib_path, "/var/lib/mon") _cset(:mon_log_path, "/var/log/mon") + _cset(:mon_hostgroup_name) { application } + _cset(:mon_hostgroup, %w(localhost)) + _cset(:mon_services, {}) + # + # Example: + # + # set(:mon_services) {{ + # "ping" => { + # :description => "Responses to ping", + # :interval => "5m", + # :monitor => "fping.monitor", + # :period => "wd {Mon-Fri} hr {7am-10pm}", + # :alert => "mail.alert root@localhost", + # :alertevery => "1h", + # }, + # "http" => { + # :description => "HTTP service", + # :interval => "10m", + # :monitor => "http.monitor", + # :period => "", + # :numalerts => 10, + # :alert => "mail.alert root@localhost", + # :upalert => "mail.alert root@localhost", + # }, + # "smtp" => { + # :description => "SMTP service", + # :interval => "10m", + # :monitor => "smtp.monitor -t 60", + # :period => "", + # :numalerts => 10, + # :alert => "mail.alert root@localhost", + # :upalert => "mail.alert root@localhost", + # }, + # }} + # + desc("Setup mon.") task(:setup, :roles => :app, :except => { :no_release => true }) { transaction { install _update @@ -83,9 +119,23 @@ path end _cset(:mon_plugins_path, "/usr/local/lib/mon") _cset(:mon_plugins, []) + # + # Example: + # + # ## simple definition + # set(:mon_plugins, %w( + # https://example.com/foo.alert + # https://example.com/bar.monitor + # )) + # + # ## use custom plugin name + # set(:mon_plugins) {{ + # "https://gist.github.com/raw/2321002/pyhttp.monitor.py" => "pyhttp.monitor", + # }} + # task(:update_plugins, :roles => :app, :except => { :no_release => true }) { srcs = mon_plugins.map { |uri, name| uri } tmps = mon_plugins.map { |uri, name| tempfile('capistrano-mon') } dsts = mon_plugins.map { |uri, name| basename = File.basename(name || URI.parse(uri).path)