sensu 0.26.5 → 0.27.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/sensu/api/routes.rb +1 -0
- data/lib/sensu/api/routes/silenced.rb +21 -1
- data/lib/sensu/client/process.rb +4 -1
- data/lib/sensu/constants.rb +1 -1
- data/lib/sensu/daemon.rb +9 -8
- data/lib/sensu/server/filter.rb +12 -8
- data/sensu.gemspec +8 -8
- metadata +21 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 889fe13d5be50c9cb7fb891ee70290c5da0815f5
|
4
|
+
data.tar.gz: ee86423e7b3d8837b869904dbb7ae050e58dce15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac0100bdec9cba408c27ef4bae7c2b511e5260aec4868881b0754a128a94871a029a3747bdee653a2a6d229ed32ca5e5c9a780b0fc140a3454ef29290d953b19
|
7
|
+
data.tar.gz: b84039c62794fa94cdcb2cc44beec273fa1d89fe8514ae8d289b698db7a1afd00ae0c9e22f2582290ee25dc0764a69e8604d653c521fa96523c3117430a325d7
|
data/CHANGELOG.md
CHANGED
data/lib/sensu/api/routes.rb
CHANGED
@@ -53,6 +53,7 @@ module Sensu
|
|
53
53
|
[RESULTS_CLIENT_URI, :get_results_client],
|
54
54
|
[RESULT_URI, :get_result],
|
55
55
|
[SILENCED_URI, :get_silenced],
|
56
|
+
[SILENCED_ID_URI, :get_silenced_id],
|
56
57
|
[SILENCED_SUBSCRIPTION_URI, :get_silenced_subscription],
|
57
58
|
[SILENCED_CHECK_URI, :get_silenced_check]
|
58
59
|
]
|
@@ -3,6 +3,7 @@ module Sensu
|
|
3
3
|
module Routes
|
4
4
|
module Silenced
|
5
5
|
SILENCED_URI = /^\/silenced$/
|
6
|
+
SILENCED_ID_URI = /^\/silenced\/ids\/([\w\.\-\*\:]+)$/
|
6
7
|
SILENCED_SUBSCRIPTION_URI = /^\/silenced\/subscriptions\/([\w\.\-:]+)$/
|
7
8
|
SILENCED_CHECK_URI = /^\/silenced\/checks\/([\w\.\-]+)$/
|
8
9
|
SILENCED_CLEAR_URI = /^\/silenced\/clear$/
|
@@ -45,7 +46,7 @@ module Sensu
|
|
45
46
|
# POST /silenced
|
46
47
|
def post_silenced
|
47
48
|
rules = {
|
48
|
-
:subscription => {:type => String, :nil_ok => true},
|
49
|
+
:subscription => {:type => String, :nil_ok => true, :regex => /\A[\w\.\-\:]+\z/},
|
49
50
|
:check => {:type => String, :nil_ok => true, :regex => /\A[\w\.-]+\z/},
|
50
51
|
:expire => {:type => Integer, :nil_ok => true},
|
51
52
|
:reason => {:type => String, :nil_ok => true},
|
@@ -109,6 +110,25 @@ module Sensu
|
|
109
110
|
end
|
110
111
|
end
|
111
112
|
|
113
|
+
# GET /silenced/ids/:id
|
114
|
+
def get_silenced_id
|
115
|
+
id = parse_uri(SILENCED_ID_URI).first
|
116
|
+
@redis.smembers("silenced") do |silenced_keys|
|
117
|
+
silenced_keys.select! do |key|
|
118
|
+
key =~ /#{id.gsub('*', '\*')}$/
|
119
|
+
end
|
120
|
+
silenced_keys = pagination(silenced_keys)
|
121
|
+
fetch_silenced(silenced_keys) do |silenced|
|
122
|
+
if silenced.empty?
|
123
|
+
not_found!
|
124
|
+
else
|
125
|
+
@response_content = silenced.last
|
126
|
+
respond
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
112
132
|
# GET /silenced/checks/:check
|
113
133
|
def get_silenced_check
|
114
134
|
check_name = parse_uri(SILENCED_CHECK_URI).first
|
data/lib/sensu/client/process.rb
CHANGED
@@ -496,8 +496,11 @@ module Sensu
|
|
496
496
|
# deregistration check result if configured to do so.
|
497
497
|
def stop
|
498
498
|
@logger.warn("stopping")
|
499
|
+
last_state = @state
|
499
500
|
pause
|
500
|
-
|
501
|
+
if @settings[:client][:deregister] == true && last_state != :initializing
|
502
|
+
deregister
|
503
|
+
end
|
501
504
|
@state = :stopping
|
502
505
|
complete_checks_in_progress do
|
503
506
|
close_sockets
|
data/lib/sensu/constants.rb
CHANGED
data/lib/sensu/daemon.rb
CHANGED
@@ -2,14 +2,14 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
gem "eventmachine", "1.2.0.1"
|
4
4
|
|
5
|
-
gem "sensu-json", "2.0.
|
6
|
-
gem "sensu-logger", "1.2.
|
7
|
-
gem "sensu-settings", "9.2.
|
8
|
-
gem "sensu-extension", "1.5.
|
9
|
-
gem "sensu-extensions", "1.7.
|
10
|
-
gem "sensu-transport", "
|
11
|
-
gem "sensu-spawn", "2.2.
|
12
|
-
gem "sensu-redis", "
|
5
|
+
gem "sensu-json", "2.0.1"
|
6
|
+
gem "sensu-logger", "1.2.1"
|
7
|
+
gem "sensu-settings", "9.2.2"
|
8
|
+
gem "sensu-extension", "1.5.1"
|
9
|
+
gem "sensu-extensions", "1.7.1"
|
10
|
+
gem "sensu-transport", "7.0.2"
|
11
|
+
gem "sensu-spawn", "2.2.1"
|
12
|
+
gem "sensu-redis", "2.0.0"
|
13
13
|
|
14
14
|
require "time"
|
15
15
|
require "uri"
|
@@ -286,6 +286,7 @@ module Sensu
|
|
286
286
|
# connection object to the callback/block.
|
287
287
|
def setup_redis
|
288
288
|
@logger.debug("connecting to redis", :settings => @settings[:redis])
|
289
|
+
Redis.logger = @logger
|
289
290
|
Redis.connect(@settings[:redis]) do |connection|
|
290
291
|
@redis = connection
|
291
292
|
@redis.on_error do |error|
|
data/lib/sensu/server/filter.rb
CHANGED
@@ -180,13 +180,14 @@ module Sensu
|
|
180
180
|
# parameter to indicate if the event was filtered.
|
181
181
|
# @yieldparam filtered [TrueClass,FalseClass] indicating if the
|
182
182
|
# event was filtered.
|
183
|
+
# @yieldparam filter_name [String] name of the filter being evaluated
|
183
184
|
def native_filter(filter_name, event)
|
184
185
|
filter = @settings[:filters][filter_name]
|
185
186
|
if in_filter_time_windows?(filter)
|
186
187
|
matched = filter_attributes_match?(event, filter[:attributes])
|
187
|
-
yield(filter[:negate] ? matched : !matched)
|
188
|
+
yield(filter[:negate] ? matched : !matched, filter_name)
|
188
189
|
else
|
189
|
-
yield(false)
|
190
|
+
yield(false, filter_name)
|
190
191
|
end
|
191
192
|
end
|
192
193
|
|
@@ -198,14 +199,15 @@ module Sensu
|
|
198
199
|
# parameter to indicate if the event was filtered.
|
199
200
|
# @yieldparam filtered [TrueClass,FalseClass] indicating if the
|
200
201
|
# event was filtered.
|
202
|
+
# @yieldparam filter_name [String] name of the filter being evaluated
|
201
203
|
def extension_filter(filter_name, event)
|
202
204
|
extension = @extensions[:filters][filter_name]
|
203
205
|
if in_filter_time_windows?(extension.definition)
|
204
206
|
extension.safe_run(event) do |output, status|
|
205
|
-
yield(status == 0)
|
207
|
+
yield(status == 0, filter_name)
|
206
208
|
end
|
207
209
|
else
|
208
|
-
yield(false)
|
210
|
+
yield(false, filter_name)
|
209
211
|
end
|
210
212
|
end
|
211
213
|
|
@@ -223,19 +225,20 @@ module Sensu
|
|
223
225
|
# parameter to indicate if the event was filtered.
|
224
226
|
# @yieldparam filtered [TrueClass,FalseClass] indicating if the
|
225
227
|
# event was filtered.
|
228
|
+
# @yieldparam filter_name [String] name of the filter being evaluated
|
226
229
|
def event_filter(filter_name, event)
|
227
230
|
case
|
228
231
|
when @settings.filter_exists?(filter_name)
|
229
232
|
native_filter(filter_name, event) do |filtered|
|
230
|
-
yield(filtered)
|
233
|
+
yield(filtered, filter_name)
|
231
234
|
end
|
232
235
|
when @extensions.filter_exists?(filter_name)
|
233
236
|
extension_filter(filter_name, event) do |filtered|
|
234
|
-
yield(filtered)
|
237
|
+
yield(filtered, filter_name)
|
235
238
|
end
|
236
239
|
else
|
237
240
|
@logger.error("unknown filter", :filter_name => filter_name)
|
238
|
-
yield(false)
|
241
|
+
yield(false, filter_name)
|
239
242
|
end
|
240
243
|
end
|
241
244
|
|
@@ -298,10 +301,11 @@ module Sensu
|
|
298
301
|
@logger.info(filter_message, details)
|
299
302
|
@in_progress[:events] -= 1 if @in_progress
|
300
303
|
else
|
301
|
-
event_filtered?(handler, event) do |filtered|
|
304
|
+
event_filtered?(handler, event) do |filtered, filter_name|
|
302
305
|
unless filtered
|
303
306
|
yield(event)
|
304
307
|
else
|
308
|
+
details[:filter] = filter_name
|
305
309
|
@logger.info("event was filtered", details)
|
306
310
|
@in_progress[:events] -= 1 if @in_progress
|
307
311
|
end
|
data/sensu.gemspec
CHANGED
@@ -13,14 +13,14 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.has_rdoc = false
|
14
14
|
|
15
15
|
s.add_dependency "eventmachine", "1.2.0.1"
|
16
|
-
s.add_dependency "sensu-json", "2.0.
|
17
|
-
s.add_dependency "sensu-logger", "1.2.
|
18
|
-
s.add_dependency "sensu-settings", "9.2.
|
19
|
-
s.add_dependency "sensu-extension", "1.5.
|
20
|
-
s.add_dependency "sensu-extensions", "1.7.
|
21
|
-
s.add_dependency "sensu-transport", "
|
22
|
-
s.add_dependency "sensu-spawn", "2.2.
|
23
|
-
s.add_dependency "sensu-redis", "
|
16
|
+
s.add_dependency "sensu-json", "2.0.1"
|
17
|
+
s.add_dependency "sensu-logger", "1.2.1"
|
18
|
+
s.add_dependency "sensu-settings", "9.2.2"
|
19
|
+
s.add_dependency "sensu-extension", "1.5.1"
|
20
|
+
s.add_dependency "sensu-extensions", "1.7.1"
|
21
|
+
s.add_dependency "sensu-transport", "7.0.2"
|
22
|
+
s.add_dependency "sensu-spawn", "2.2.1"
|
23
|
+
s.add_dependency "sensu-redis", "2.0.0"
|
24
24
|
s.add_dependency "em-http-server", "0.1.8"
|
25
25
|
|
26
26
|
s.add_development_dependency "rake", "10.5.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.27.0.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
@@ -31,112 +31,112 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 2.0.
|
34
|
+
version: 2.0.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 2.0.
|
41
|
+
version: 2.0.1
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: sensu-logger
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - '='
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.2.
|
48
|
+
version: 1.2.1
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - '='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.2.
|
55
|
+
version: 1.2.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: sensu-settings
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - '='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 9.2.
|
62
|
+
version: 9.2.2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 9.2.
|
69
|
+
version: 9.2.2
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: sensu-extension
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.5.
|
76
|
+
version: 1.5.1
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 1.5.
|
83
|
+
version: 1.5.1
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: sensu-extensions
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.7.
|
90
|
+
version: 1.7.1
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1.7.
|
97
|
+
version: 1.7.1
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: sensu-transport
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - '='
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
104
|
+
version: 7.0.2
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - '='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
111
|
+
version: 7.0.2
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: sensu-spawn
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - '='
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 2.2.
|
118
|
+
version: 2.2.1
|
119
119
|
type: :runtime
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - '='
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 2.2.
|
125
|
+
version: 2.2.1
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: sensu-redis
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - '='
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
132
|
+
version: 2.0.0
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - '='
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 2.0.0
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: em-http-server
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -275,12 +275,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
275
275
|
version: '0'
|
276
276
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
277
277
|
requirements:
|
278
|
-
- - "
|
278
|
+
- - ">"
|
279
279
|
- !ruby/object:Gem::Version
|
280
|
-
version:
|
280
|
+
version: 1.3.1
|
281
281
|
requirements: []
|
282
282
|
rubyforge_project:
|
283
|
-
rubygems_version: 2.6.
|
283
|
+
rubygems_version: 2.6.3
|
284
284
|
signing_key:
|
285
285
|
specification_version: 4
|
286
286
|
summary: A monitoring framework
|