sensu 1.4.3 → 1.5.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +6 -0
- data/lib/sensu/api/routes/clients.rb +1 -0
- data/lib/sensu/api/routes/results.rb +12 -11
- data/lib/sensu/api/validators/check.rb +55 -0
- data/lib/sensu/client/utils.rb +0 -9
- data/lib/sensu/client/validators/check.rb +9 -2
- data/lib/sensu/constants.rb +1 -1
- data/lib/sensu/daemon.rb +1 -1
- data/sensu.gemspec +1 -1
- metadata +5 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd7b102ebf9542da1c8e67721efb465c978f3978
|
4
|
+
data.tar.gz: '0950ca2940859b00064f57c3aea3ec52d37df446'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c702e3136fa2c612b8f1b8d297de375ea0f3487f029485364915ea1fb43685ead29bc06114e3e3571d0b5781764b0ae89d42df49ecf86d448aa37996eae5364
|
7
|
+
data.tar.gz: 0451e6005668651a87f14eed8b7baa22300f7dd14d1ad37ad77c73fa5648b158044bd6c5b1e24cd3398728e1d8123d2fcbcb88e79670f9f27e16a78c66d9971c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.5.0] - 2018-09-04
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- Bumped sensu-extensions to version 1.10.0 to include subscription support in the check dependencies filter.
|
12
|
+
- Improved check result validation by applying existing validation rules from sensu-settings to check results created using the API and the client socket.
|
13
|
+
|
8
14
|
## [1.4.3] - 2018-07-23
|
9
15
|
|
10
16
|
### Fixed
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "sensu/api/validators/check"
|
1
2
|
require "sensu/api/utilities/publish_check_result"
|
2
3
|
|
3
4
|
module Sensu
|
@@ -12,17 +13,17 @@ module Sensu
|
|
12
13
|
|
13
14
|
# POST /results
|
14
15
|
def post_results
|
15
|
-
|
16
|
-
:
|
17
|
-
:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
read_data do |check|
|
17
|
+
check[:status] ||= 0
|
18
|
+
check[:executed] ||= Time.now.to_i
|
19
|
+
validator = Validators::Check.new
|
20
|
+
if validator.valid?(check)
|
21
|
+
publish_check_result("sensu-api", check)
|
22
|
+
@response_content = {:issued => Time.now.to_i}
|
23
|
+
accepted!
|
24
|
+
else
|
25
|
+
bad_request!
|
26
|
+
end
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "sensu/api/validators/invalid"
|
2
|
+
require "sensu/settings/rules"
|
3
|
+
require "sensu/settings/validators/check"
|
4
|
+
|
5
|
+
module Sensu
|
6
|
+
module API
|
7
|
+
module Validators
|
8
|
+
class Check
|
9
|
+
# Include Sensu Settings rules and check validator.
|
10
|
+
include Sensu::Settings::Rules
|
11
|
+
include Sensu::Settings::Validators::Check
|
12
|
+
|
13
|
+
# Validate a check result, selectively using check definition
|
14
|
+
# validation methods.
|
15
|
+
#
|
16
|
+
# @param check [Hash]
|
17
|
+
def validate_check_result(check)
|
18
|
+
must_be_a_string(check[:output]) ||
|
19
|
+
invalid(check, "check output must be a string")
|
20
|
+
must_be_an_integer(check[:status]) ||
|
21
|
+
invalid(check, "check status must be an integer")
|
22
|
+
must_be_an_integer(check[:executed]) ||
|
23
|
+
invalid(check, "check executed timestamp must be an integer")
|
24
|
+
validate_check_name(check)
|
25
|
+
validate_check_handling(check)
|
26
|
+
validate_check_aggregate(check)
|
27
|
+
validate_check_flap_detection(check)
|
28
|
+
validate_check_truncate_output(check)
|
29
|
+
validate_check_source(check) if check[:source]
|
30
|
+
validate_check_ttl(check) if check[:ttl]
|
31
|
+
end
|
32
|
+
|
33
|
+
# Determine if a check definition is valid.
|
34
|
+
#
|
35
|
+
# @param check [Hash]
|
36
|
+
# @return [TrueClass, FalseClass]
|
37
|
+
def valid?(check)
|
38
|
+
validate_check_result(check)
|
39
|
+
true
|
40
|
+
rescue Invalid
|
41
|
+
false
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
# This method is called when validation methods encounter an
|
47
|
+
# invalid definition object. This method raises an exception
|
48
|
+
# to be caught by `valid?()`.
|
49
|
+
def invalid(*arguments)
|
50
|
+
raise Invalid
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/sensu/client/utils.rb
CHANGED
@@ -14,15 +14,6 @@ module Sensu
|
|
14
14
|
unless validator.valid?(check)
|
15
15
|
raise DataError, validator.failures.first[:message]
|
16
16
|
end
|
17
|
-
unless check[:output].is_a?(String)
|
18
|
-
raise DataError, "check output must be a string"
|
19
|
-
end
|
20
|
-
unless check[:status].is_a?(Integer)
|
21
|
-
raise DataError, "check status must be an integer"
|
22
|
-
end
|
23
|
-
unless check[:executed].is_a?(Integer)
|
24
|
-
raise DataError, "check executed timestamp must be an integer"
|
25
|
-
end
|
26
17
|
end
|
27
18
|
|
28
19
|
# Process a check result. Set check result attribute defaults,
|
@@ -20,12 +20,19 @@ module Sensu
|
|
20
20
|
# @param client [Hash]
|
21
21
|
# @return [TrueClass, FalseClass]
|
22
22
|
def valid?(check)
|
23
|
+
must_be_a_string(check[:output]) ||
|
24
|
+
invalid(check, "check output must be a string")
|
25
|
+
must_be_an_integer(check[:status]) ||
|
26
|
+
invalid(check, "check status must be an integer")
|
27
|
+
must_be_an_integer(check[:executed]) ||
|
28
|
+
invalid(check, "check executed timestamp must be an integer")
|
23
29
|
validate_check_name(check)
|
24
|
-
validate_check_source(check) if check[:source]
|
25
30
|
validate_check_handling(check)
|
26
|
-
validate_check_ttl(check) if check[:ttl]
|
27
31
|
validate_check_aggregate(check)
|
28
32
|
validate_check_flap_detection(check)
|
33
|
+
validate_check_truncate_output(check)
|
34
|
+
validate_check_source(check) if check[:source]
|
35
|
+
validate_check_ttl(check) if check[:ttl]
|
29
36
|
@failures.empty?
|
30
37
|
end
|
31
38
|
|
data/lib/sensu/constants.rb
CHANGED
data/lib/sensu/daemon.rb
CHANGED
@@ -6,7 +6,7 @@ gem "sensu-json", "2.1.1"
|
|
6
6
|
gem "sensu-logger", "1.2.2"
|
7
7
|
gem "sensu-settings", "10.14.0"
|
8
8
|
gem "sensu-extension", "1.5.2"
|
9
|
-
gem "sensu-extensions", "1.
|
9
|
+
gem "sensu-extensions", "1.10.0"
|
10
10
|
gem "sensu-transport", "7.1.0"
|
11
11
|
gem "sensu-spawn", "2.5.0"
|
12
12
|
gem "sensu-redis", "2.3.0"
|
data/sensu.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_dependency "sensu-logger", "1.2.2"
|
17
17
|
s.add_dependency "sensu-settings", "10.14.0"
|
18
18
|
s.add_dependency "sensu-extension", "1.5.2"
|
19
|
-
s.add_dependency "sensu-extensions", "1.
|
19
|
+
s.add_dependency "sensu-extensions", "1.10.0"
|
20
20
|
s.add_dependency "sensu-transport", "7.1.0"
|
21
21
|
s.add_dependency "sensu-spawn", "2.5.0"
|
22
22
|
s.add_dependency "sensu-redis", "2.3.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: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
jOeGyhtQa9j4FFmsEJDg59f5v/3hECXsa3Xuml3foaFHzX3Ya/YIyd2YFxvkFKIu
|
32
32
|
GVbe7A3YdxzdkH2Es/Ym9twdxXaIDdXzj8sWhw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2018-
|
34
|
+
date: 2018-09-04 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: eventmachine
|
@@ -109,14 +109,14 @@ dependencies:
|
|
109
109
|
requirements:
|
110
110
|
- - '='
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 1.
|
112
|
+
version: 1.10.0
|
113
113
|
type: :runtime
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - '='
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: 1.
|
119
|
+
version: 1.10.0
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
121
|
name: sensu-transport
|
122
122
|
requirement: !ruby/object:Gem::Requirement
|
@@ -299,6 +299,7 @@ files:
|
|
299
299
|
- lib/sensu/api/utilities/resolve_event.rb
|
300
300
|
- lib/sensu/api/utilities/servers_info.rb
|
301
301
|
- lib/sensu/api/utilities/transport_info.rb
|
302
|
+
- lib/sensu/api/validators/check.rb
|
302
303
|
- lib/sensu/api/validators/client.rb
|
303
304
|
- lib/sensu/api/validators/invalid.rb
|
304
305
|
- lib/sensu/cli.rb
|
metadata.gz.sig
CHANGED
Binary file
|