capistrano-mon 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,14 +18,32 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- * `:mon_path` - "/etc/mon"
22
- * `:mon_lib_path` - "/var/lib/mon"
23
- * `:mon_log_path` - "/var/log/mon"
24
- * `:mon_dependencies` - `%w(mon)`
25
- * `:mon_plugins_path` - "/usr/local/lib/mon"
26
- * `:mon_plugins` - `{}`
27
- * `:mon_configure_files` - `%w(/etc/default/mon mon.cf))`
28
- * `:mon_service_name` - `"mon"`
21
+ This recipe will setup Mon during `deploy:setup` task.
22
+
23
+ To enable this recipe, add following in your `config/deploy.rb`.
24
+
25
+ # in "config/deploy.rb"
26
+ require "capistrano-mon"
27
+ set(:mon_services) {{
28
+ "ping" => {
29
+ :description => "Responses to ping",
30
+ :interval => "5m",
31
+ :monitor => "fping.monitor",
32
+ :period => "wd {Mon-Fri} hr {7am-10pm}",
33
+ :alert => "mail.alert root@localhost",
34
+ :alertevery => "1h",
35
+ }
36
+ }
37
+
38
+ Following options are available to configure your Mon.
39
+
40
+ * `:mon_path` - The base path of Mon configurations. Use `/etc/mon` by default.
41
+ * `:mon_services` - The key-value map of `service` definitions of Mon.
42
+ * `:mon_dependencies` - The packages of Mon.
43
+ * `:mon_plugins_path` - The installation path for custom plugins.
44
+ * `:mon_plugins` - The information of custom plugins.
45
+ * `:mon_configure_files` - The configuration files of Mon.
46
+ * `:mon_service_name` - The name of Mon service. Use `mon` by default.
29
47
 
30
48
  ## Contributing
31
49
 
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Capistrano::Mon::VERSION
9
9
  gem.authors = ["Yamashita Yuu"]
10
10
  gem.email = ["yamashita@geishatokyo.com"]
11
- gem.description = %q{a capistrano recipe to setup mon.}
12
- gem.summary = %q{a capistrano recipe to setup mon.}
11
+ gem.description = %q{a capistrano recipe to setup Mon.}
12
+ gem.summary = %q{a capistrano recipe to setup Mon.}
13
13
  gem.homepage = "https://github.com/yyuu/capistrano-mon"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
@@ -11,6 +11,42 @@ module Capistrano
11
11
  _cset(:mon_path, "/etc/mon")
12
12
  _cset(:mon_lib_path, "/var/lib/mon")
13
13
  _cset(:mon_log_path, "/var/log/mon")
14
+ _cset(:mon_hostgroup_name) { application }
15
+ _cset(:mon_hostgroup, %w(localhost))
16
+ _cset(:mon_services, {})
17
+ #
18
+ # Example:
19
+ #
20
+ # set(:mon_services) {{
21
+ # "ping" => {
22
+ # :description => "Responses to ping",
23
+ # :interval => "5m",
24
+ # :monitor => "fping.monitor",
25
+ # :period => "wd {Mon-Fri} hr {7am-10pm}",
26
+ # :alert => "mail.alert root@localhost",
27
+ # :alertevery => "1h",
28
+ # },
29
+ # "http" => {
30
+ # :description => "HTTP service",
31
+ # :interval => "10m",
32
+ # :monitor => "http.monitor",
33
+ # :period => "",
34
+ # :numalerts => 10,
35
+ # :alert => "mail.alert root@localhost",
36
+ # :upalert => "mail.alert root@localhost",
37
+ # },
38
+ # "smtp" => {
39
+ # :description => "SMTP service",
40
+ # :interval => "10m",
41
+ # :monitor => "smtp.monitor -t 60",
42
+ # :period => "",
43
+ # :numalerts => 10,
44
+ # :alert => "mail.alert root@localhost",
45
+ # :upalert => "mail.alert root@localhost",
46
+ # },
47
+ # }}
48
+ #
49
+
14
50
  desc("Setup mon.")
15
51
  task(:setup, :roles => :app, :except => { :no_release => true }) {
16
52
  transaction {
@@ -85,6 +121,20 @@ module Capistrano
85
121
 
86
122
  _cset(:mon_plugins_path, "/usr/local/lib/mon")
87
123
  _cset(:mon_plugins, [])
124
+ #
125
+ # Example:
126
+ #
127
+ # ## simple definition
128
+ # set(:mon_plugins, %w(
129
+ # https://example.com/foo.alert
130
+ # https://example.com/bar.monitor
131
+ # ))
132
+ #
133
+ # ## use custom plugin name
134
+ # set(:mon_plugins) {{
135
+ # "https://gist.github.com/raw/2321002/pyhttp.monitor.py" => "pyhttp.monitor",
136
+ # }}
137
+ #
88
138
  task(:update_plugins, :roles => :app, :except => { :no_release => true }) {
89
139
  srcs = mon_plugins.map { |uri, name| uri }
90
140
  tmps = mon_plugins.map { |uri, name| tempfile('capistrano-mon') }
@@ -21,12 +21,12 @@ dtlogfile = <%= fetch(:mon_dtlogfile, "dtlog") %>
21
21
  #
22
22
  # Define groups of hosts to monitor
23
23
  #
24
- hostgroup localhost <%= fetch(:mon_hostgroup, %w(localhost)).join(' ') %>
24
+ hostgroup <%= mon_hostgroup_name %> <%= mon_hostgroup.join(' ') %>
25
25
 
26
26
  #
27
27
  # Define watches
28
28
  #
29
- watch localhost<% fetch(:mon_services, {}).each { |service_name, service_defs| %>
29
+ watch <%= mon_hostgroup_name %><% fetch(:mon_services, {}).each { |service_name, service_defs| %>
30
30
  service <%= service_name %><% service_defs.each { |monitor_name, monitor_def| %><% if Array === monitor_def %><% monitor_def.each { |d| %>
31
31
  <%= monitor_name %> <%= d %><% } %><% else %>
32
32
  <%= monitor_name %> <%= monitor_def %><% end %><% } %><% } %>
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Mon
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-mon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-07 00:00:00.000000000 Z
12
+ date: 2012-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -27,7 +27,7 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
- description: a capistrano recipe to setup mon.
30
+ description: a capistrano recipe to setup Mon.
31
31
  email:
32
32
  - yamashita@geishatokyo.com
33
33
  executables: []
@@ -67,5 +67,5 @@ rubyforge_project:
67
67
  rubygems_version: 1.8.23
68
68
  signing_key:
69
69
  specification_version: 3
70
- summary: a capistrano recipe to setup mon.
70
+ summary: a capistrano recipe to setup Mon.
71
71
  test_files: []