luban-monit 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4ff6bf96ef011c09c671981ce035af92ea35956
|
4
|
+
data.tar.gz: 19f86daa270dbcb17215d7de1ee22f4a2eb8056f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cd947baf88fa2336f2774c156e1e6a82b43419bf4e15a8cb3bb8e6b4d954e05a21c81ffe88c1127adb3520380fdc27b4d5cefdb73f852637f79a680c676b4a9
|
7
|
+
data.tar.gz: 2bbf8bbf23902668c865b8c11eb530ee98411900f2b36bc84a7edada5ceeab8c5ba7e43a30d59b348128ece4353fc252f93ddffd16220ba70c882dc40788ef25
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## Version 0.2.3 (Sept 19, 2016)
|
4
|
+
|
5
|
+
New features:
|
6
|
+
* Added commands to monitor/unmonitor named service
|
7
|
+
* Provided the above commands to other Luban services/apps thru module Monit::Controller::Commands::Public
|
8
|
+
* As a result, bumped up the gem dependency on Luban to version 0.8.1
|
9
|
+
|
10
|
+
Minor enhancements:
|
11
|
+
* Refactored the way of composing shell commands
|
12
|
+
* Fixed regular expression to check process start to support Monit 5.19.0
|
13
|
+
* Minor code cleanup
|
14
|
+
|
3
15
|
## Version 0.2.2 (Sept 06, 2016)
|
4
16
|
|
5
17
|
Minor enhancements:
|
@@ -8,7 +8,8 @@ module Luban
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
%i(config_test
|
11
|
+
%i(config_test match_process monitor_process
|
12
|
+
unmonitor_process reload_process).each do |action|
|
12
13
|
service_action action, dispatch_to: :controller
|
13
14
|
end
|
14
15
|
|
@@ -42,6 +43,18 @@ module Luban
|
|
42
43
|
argument :pattern, "Regex for process match"
|
43
44
|
action! :match_process
|
44
45
|
end
|
46
|
+
|
47
|
+
task :monitor do
|
48
|
+
desc "Enable monitoring"
|
49
|
+
argument :service_entry, "Servie entry name"
|
50
|
+
action! :monitor_process
|
51
|
+
end
|
52
|
+
|
53
|
+
task :unmonitor do
|
54
|
+
desc "Disable monitoring"
|
55
|
+
argument :service_entry, "Servie entry name"
|
56
|
+
action! :unmonitor_process
|
57
|
+
end
|
45
58
|
end
|
46
59
|
end
|
47
60
|
end
|
@@ -4,6 +4,22 @@ module Luban
|
|
4
4
|
class Monit
|
5
5
|
class Controller < Luban::Deployment::Service::Controller
|
6
6
|
module Commands
|
7
|
+
module Public
|
8
|
+
def monitor_command(service_entry)
|
9
|
+
@monitor_command ||= shell_command("#{monitor_executable} monitor #{service_entry}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def unmonitor_command(service_entry)
|
13
|
+
@unmonitor_command ||= shell_command("#{monitor_executable} unmonitor #{service_entry}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def reload_monitor_command
|
17
|
+
@reload_monitor_command ||= shell_command("#{monitor_executable} reload")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
include Public
|
22
|
+
|
7
23
|
def self.included(base)
|
8
24
|
base.define_executable 'monit'
|
9
25
|
end
|
@@ -11,15 +27,18 @@ module Luban
|
|
11
27
|
def monit_command
|
12
28
|
@monit_command ||= "#{monit_executable}"
|
13
29
|
end
|
30
|
+
alias_method :monitor_executable, :monit_command
|
14
31
|
|
15
32
|
def process_pattern
|
16
33
|
@process_pattern ||= "^#{monit_command}"
|
17
34
|
end
|
18
35
|
|
19
|
-
|
36
|
+
def start_command
|
37
|
+
@start_command ||= shell_command(monit_command)
|
38
|
+
end
|
20
39
|
|
21
40
|
def stop_command
|
22
|
-
@stop_command ||= "#{monit_command} quit"
|
41
|
+
@stop_command ||= shell_command("#{monit_command} quit")
|
23
42
|
end
|
24
43
|
end
|
25
44
|
|
@@ -30,37 +49,37 @@ module Luban
|
|
30
49
|
end
|
31
50
|
|
32
51
|
def process_started?
|
33
|
-
super and check_process! =~ /^The Monit daemon #{package_major_version} uptime
|
34
|
-
end
|
35
|
-
|
36
|
-
def config_test
|
37
|
-
update_result config_test!
|
38
|
-
end
|
39
|
-
|
40
|
-
def reload_process
|
41
|
-
update_result reload_process!
|
52
|
+
super and check_process! =~ /^Monit #{package_major_version} uptime:|^Monit uptime:|^The Monit daemon #{package_major_version} uptime:/
|
42
53
|
end
|
43
54
|
|
44
|
-
|
45
|
-
update_result
|
55
|
+
%i(config_test match_process monitor_process unmonitor_process reload_process).each do |m|
|
56
|
+
define_method(m) { update_result send("#{__method__}!") }
|
46
57
|
end
|
47
58
|
|
48
59
|
protected
|
49
60
|
|
50
61
|
def config_test!
|
51
|
-
capture(
|
62
|
+
capture(shell_command("#{monit_command} -t"))
|
52
63
|
end
|
53
64
|
|
54
65
|
def check_process!
|
55
|
-
capture(
|
66
|
+
capture(shell_command("#{monit_command} status"))
|
56
67
|
end
|
57
68
|
|
58
|
-
def
|
59
|
-
capture(
|
69
|
+
def match_process!
|
70
|
+
capture(shell_command("#{monit_command} procmatch #{task.args.pattern}"))
|
60
71
|
end
|
61
72
|
|
62
|
-
def
|
63
|
-
capture(
|
73
|
+
def monitor_process!
|
74
|
+
capture(monitor_command(task.args.service_entry))
|
75
|
+
end
|
76
|
+
|
77
|
+
def unmonitor_process!
|
78
|
+
capture(unmonitor_command(task.args.service_entry))
|
79
|
+
end
|
80
|
+
|
81
|
+
def reload_process!
|
82
|
+
capture(reload_monitor_command)
|
64
83
|
end
|
65
84
|
end
|
66
85
|
end
|
data/luban-monit.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.required_ruby_version = ">= 2.1.0"
|
23
|
-
spec.add_dependency 'luban', ">= 0.
|
23
|
+
spec.add_dependency 'luban', ">= 0.8.1"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.11"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luban-monit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rubyist Chi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luban
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.8.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|