kurchatov 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -2
- data/lib/kurchatov/application.rb +0 -6
- data/lib/kurchatov/config.rb +0 -1
- data/lib/kurchatov/mixin/monitor.rb +1 -1
- data/lib/kurchatov/monitor.rb +8 -12
- data/lib/kurchatov/version.rb +1 -1
- data/tests/data/config.yml +6 -12
- data/tests/data/event.yml +12 -5
- data/tests/data/{plugin_sample.rb → plugins/plugin_data.rb} +3 -3
- data/tests/data/plugins/plugin_ignore_errors_with_count.rb_ +14 -0
- data/tests/data/{plugin_with_errors.rb → plugins/plugin_ingore_errors.rb} +3 -2
- data/tests/data/plugins/plugin_multi_start.rb +11 -0
- data/tests/data/plugins/plugin_not_ignore_errors.rb_ +9 -0
- data/tests/data/plugins/plugin_sleep.rb +8 -0
- data/tests/run.sh +1 -1
- data/tests/testreceived.rb +1 -1
- metadata +9 -6
- data/tests/data/plugin_with_errors_with_count.rb +0 -8
- /data/tests/data/{plugin_dont_start.rb → plugins/plugin_dont_start.rb} +0 -0
- /data/tests/data/{plugin_with_no_required.rb → plugins/plugin_with_no_required.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54bb6b67e8ca9aca95e11895ef1cb66645f0d68d
|
4
|
+
data.tar.gz: bcd522202de89b8fd81167443cb6bebf6bb00696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac5c7fad5c2c5540c6e321b112906d54b88b05a69316231203927b0813a6080bf057a3e301acfd26c986cbcf1675df250650d952f67b35846a80203962fdfb80
|
7
|
+
data.tar.gz: 8e5c5a3770b22afa25740fb470b53576ee0cdc6003dfc94ef542b2806fc98c86d51ba767c4d2e19dbfaf6f027883b7330e277c08d1fa68e07d5452a182577800
|
data/.travis.yml
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
1
3
|
os:
|
2
4
|
- linux
|
3
5
|
- osx
|
6
|
+
- windows
|
4
7
|
|
5
|
-
|
6
|
-
|
8
|
+
before_install:
|
9
|
+
- date -u
|
10
|
+
- uname -a
|
11
|
+
- env | sort
|
7
12
|
|
8
13
|
rvm:
|
9
14
|
- 1.9.3
|
@@ -12,3 +17,7 @@ rvm:
|
|
12
17
|
- 1.8.7
|
13
18
|
|
14
19
|
script: "./tests/run.sh"
|
20
|
+
|
21
|
+
notifications:
|
22
|
+
email:
|
23
|
+
- vadv.mkn@gmail.com
|
@@ -90,12 +90,6 @@ module Kurchatov
|
|
90
90
|
:long => '--udp 0.0.0.0:55955',
|
91
91
|
:description => 'Set udp responder for information'
|
92
92
|
|
93
|
-
option :stop_on_error,
|
94
|
-
:long => '--stop-on-error',
|
95
|
-
:description => 'Stop on plugin or connection problem',
|
96
|
-
:boolean => true,
|
97
|
-
:proc => lambda { |l| !!l }
|
98
|
-
|
99
93
|
def configure_opts
|
100
94
|
@attributes = parse_options
|
101
95
|
@attributes = nil if @attributes.empty?
|
data/lib/kurchatov/config.rb
CHANGED
data/lib/kurchatov/monitor.rb
CHANGED
@@ -40,7 +40,7 @@ module Kurchatov
|
|
40
40
|
begin
|
41
41
|
@thread.join # call error
|
42
42
|
rescue => e
|
43
|
-
desc = "Plugin '#{@plugin.name}' died. #{e.class}: #{e}
|
43
|
+
desc = "Plugin '#{@plugin.name}' died. #{e.class}: #{e}.\n" +
|
44
44
|
"Trace: #{e.backtrace.join("\n")}"
|
45
45
|
@count_errors += 1
|
46
46
|
@last_error_count += 1
|
@@ -51,7 +51,6 @@ module Kurchatov
|
|
51
51
|
event(:service => "plugin #{@plugin.name} errors", :desc => desc, :state => 'critical')
|
52
52
|
end
|
53
53
|
end
|
54
|
-
start! #FIXME
|
55
54
|
true
|
56
55
|
end
|
57
56
|
|
@@ -64,34 +63,31 @@ module Kurchatov
|
|
64
63
|
attr_accessor :tasks
|
65
64
|
CHECK_ALIVE_TIMEOUT = 5
|
66
65
|
|
67
|
-
def initialize
|
68
|
-
@stop_on_error = stop
|
66
|
+
def initialize
|
69
67
|
@tasks = Array.new
|
70
68
|
end
|
71
69
|
|
72
70
|
def <<(plugin)
|
73
71
|
Log.debug("Add new plugin: #{plugin.inspect}")
|
74
|
-
|
72
|
+
tasks << Task.new(plugin)
|
75
73
|
end
|
76
74
|
|
77
75
|
def start!
|
78
76
|
loop do
|
79
|
-
|
80
|
-
if task.died?
|
81
|
-
exit(Config[:ERROR_PLUGIN_REQ])
|
82
|
-
end
|
77
|
+
tasks.each do |task|
|
78
|
+
task.start! if task.died?
|
83
79
|
if task.stopped?
|
84
80
|
task.stop!
|
85
|
-
|
81
|
+
tasks.delete(task)
|
86
82
|
end
|
87
83
|
end
|
88
|
-
Log.debug("Check alive plugins [#{
|
84
|
+
Log.debug("Check alive plugins [#{tasks.count}]")
|
89
85
|
sleep CHECK_ALIVE_TIMEOUT
|
90
86
|
end
|
91
87
|
end
|
92
88
|
|
93
89
|
def inspect
|
94
|
-
|
90
|
+
tasks.map do |t|
|
95
91
|
{
|
96
92
|
"name" => t.name,
|
97
93
|
"config" => t.config,
|
data/lib/kurchatov/version.rb
CHANGED
data/tests/data/config.yml
CHANGED
@@ -1,16 +1,10 @@
|
|
1
1
|
not_exists:
|
2
2
|
- not error please
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
cmd: 'ls'
|
7
|
-
url: 'http://example.com'
|
8
|
-
parent: sample
|
9
|
-
sleep: 2
|
4
|
+
new_multi_start:
|
5
|
+
parent: multi_start
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
-
|
14
|
-
|
15
|
-
- url: 'https://www.kernel.org'
|
16
|
-
cmd: 'ps'
|
7
|
+
multi_start:
|
8
|
+
- event_sended: false
|
9
|
+
- event_sended: false
|
10
|
+
- event_sended: true
|
data/tests/data/event.yml
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
events:
|
2
2
|
|
3
|
+
- :service: new_multi_start
|
4
|
+
:result: ok
|
5
|
+
:miss_send_from_plugin_data: true
|
6
|
+
|
7
|
+
- :service: multi_start_0
|
8
|
+
:result: ok
|
9
|
+
:miss_send_from_plugin_data: true
|
10
|
+
|
11
|
+
- :service: multi_start_1
|
12
|
+
:result: ok
|
13
|
+
:miss_send_from_plugin_data: true
|
14
|
+
|
3
15
|
- :metric: 3
|
4
16
|
:critical: 2
|
5
17
|
:warning: 1
|
@@ -37,11 +49,6 @@ events:
|
|
37
49
|
:result: warning
|
38
50
|
:service: Shell test
|
39
51
|
|
40
|
-
- :eval_metric: 'rest_get("http://ya.ru").size'
|
41
|
-
:critical: 10
|
42
|
-
:result: critical
|
43
|
-
:service: Http get test
|
44
|
-
|
45
52
|
- :eval_metric: 'rest_get("http://127.0.0.1:55755").size'
|
46
53
|
:critical: 1
|
47
54
|
:result: critical
|
@@ -1,12 +1,12 @@
|
|
1
|
-
name "
|
1
|
+
name "plugin_data"
|
2
2
|
always_start true
|
3
3
|
|
4
4
|
collect do
|
5
5
|
data = YAML.load_file('./tests/data/event.yml')
|
6
6
|
data["events"].each do |e|
|
7
|
+
next if e[:miss_send_from_plugin_data]
|
7
8
|
e[:metric] = eval(e[:eval_metric]) if e.has_key? :eval_metric
|
8
9
|
event(e)
|
9
10
|
end
|
10
|
-
|
11
|
-
exit 0 if plugin.sleep # 1 plugin send exit 0
|
11
|
+
stop!
|
12
12
|
end
|
data/tests/run.sh
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
#!/bin/sh -e
|
2
2
|
bundle exec ruby ./tests/server.rb &
|
3
|
-
bundle exec kurchatov -c ./tests/data/config.yml -d ./tests/data -H 127.0.0.1 --http 127.0.0.1:55755
|
3
|
+
bundle exec kurchatov -c ./tests/data/config.yml -d ./tests/data/plugins -H 127.0.0.1 --http 127.0.0.1:55755 -l debug
|
data/tests/testreceived.rb
CHANGED
@@ -23,7 +23,7 @@ class TestReceived
|
|
23
23
|
from_data = data["events"].select {|x| x[:miss_count] != true }.count
|
24
24
|
from_events = @events.count
|
25
25
|
|
26
|
-
raise "Not all events recieved: from data: #{from_data} and from server: #{from_events}" unless
|
26
|
+
raise "Not all events recieved: from data: #{from_data} and from server: #{from_events}" unless from_data == from_events
|
27
27
|
|
28
28
|
puts "Recieved events:"
|
29
29
|
puts "#{@events.inspect}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kurchatov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasiliev Dmitry
|
@@ -193,11 +193,14 @@ files:
|
|
193
193
|
- lib/ohai/plugins/windows/platform.rb
|
194
194
|
- tests/data/config.yml
|
195
195
|
- tests/data/event.yml
|
196
|
-
- tests/data/
|
197
|
-
- tests/data/
|
198
|
-
- tests/data/
|
199
|
-
- tests/data/
|
200
|
-
- tests/data/
|
196
|
+
- tests/data/plugins/plugin_data.rb
|
197
|
+
- tests/data/plugins/plugin_dont_start.rb
|
198
|
+
- tests/data/plugins/plugin_ignore_errors_with_count.rb_
|
199
|
+
- tests/data/plugins/plugin_ingore_errors.rb
|
200
|
+
- tests/data/plugins/plugin_multi_start.rb
|
201
|
+
- tests/data/plugins/plugin_not_ignore_errors.rb_
|
202
|
+
- tests/data/plugins/plugin_sleep.rb
|
203
|
+
- tests/data/plugins/plugin_with_no_required.rb
|
201
204
|
- tests/run.sh
|
202
205
|
- tests/server.rb
|
203
206
|
- tests/testreceived.rb
|
File without changes
|
File without changes
|