sensu-plugins-consul 1.6.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/bin/check-consul-failures.rb +2 -0
- data/bin/check-consul-kv-ttl.rb +5 -3
- data/bin/check-consul-leader.rb +5 -3
- data/bin/check-consul-maintenance.rb +2 -0
- data/bin/check-consul-members.rb +2 -0
- data/bin/check-consul-servers.rb +2 -0
- data/bin/check-consul-service-health.rb +8 -6
- data/bin/check-service-consul.rb +17 -12
- data/lib/sensu-plugins-consul.rb +2 -0
- data/lib/sensu-plugins-consul/version.rb +5 -3
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24521ff0a65982295f0e82ae89102583e30f7e5c22590f277918cc6c43724ca9
|
4
|
+
data.tar.gz: dfad99c8d6c8f5e8037a9712f576b3d32e83efeeff1de7d5a123a60a70f39a0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2168a6c0dacbed762a7eaca57f4a8c3374b34aa376888110f7f78548d35a8cfad507e71b06cd23f1cb5e9f4d5d38b3c01aa389cce22f334f5067d62c2d8d5e84
|
7
|
+
data.tar.gz: a198f8c0a0913ccad69ef0fd3bb8ef154a3a7a1a86c956c6585ac417c04cc34034a9f55f0966211445fd4828c98237739650db427131897c3bf46553d1fb1c3a
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,16 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [2.0.0] - 2018-03-07
|
9
|
+
### Security
|
10
|
+
- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)
|
11
|
+
|
12
|
+
### Breaking Changes
|
13
|
+
- removed ruby `< 2.1` support (@majormoses)
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
- appeased the cops (@majormoses)
|
17
|
+
|
8
18
|
## [1.6.1] - 2018-03-02
|
9
19
|
### Fixed
|
10
20
|
- Bug fix for `check-consul-servers` so timeout option works (@joshbenner)
|
@@ -102,7 +112,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
102
112
|
### Added
|
103
113
|
- initial release
|
104
114
|
|
105
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/
|
115
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/2.0.0...HEAD
|
116
|
+
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.6.1...2.0.0
|
106
117
|
[1.6.1]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.6.0...1.6.1
|
107
118
|
[1.6.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.5.0...1.6.0
|
108
119
|
[1.5.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.4.1...1.5.0
|
data/bin/check-consul-kv-ttl.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-consul-kv-ttl
|
4
6
|
#
|
@@ -126,8 +128,8 @@ class CheckConsulKvTTL < Sensu::Plugin::Check::CLI
|
|
126
128
|
kv_status = kv_status.downcase
|
127
129
|
|
128
130
|
# Flag based off of status
|
129
|
-
warning 'Warning status detected!' if %w
|
130
|
-
critical 'Critical status detected!' if %w
|
131
|
+
warning 'Warning status detected!' if %w[warning].include? kv_status
|
132
|
+
critical 'Critical status detected!' if %w[critical unknown].include? kv_status
|
131
133
|
end
|
132
134
|
|
133
135
|
# Dig to the time
|
@@ -157,7 +159,7 @@ class CheckConsulKvTTL < Sensu::Plugin::Check::CLI
|
|
157
159
|
critical "TTL Expired! Elapsed Time: #{elapsed_seconds}" if elapsed_seconds > config[:critical]
|
158
160
|
warning "TTL Expiration Approaching! Elapsed Time: #{elapsed_seconds}" if elapsed_seconds > config[:warning]
|
159
161
|
ok
|
160
|
-
rescue
|
162
|
+
rescue StandardError
|
161
163
|
critical 'Unable to process DateTime objects!'
|
162
164
|
end
|
163
165
|
end
|
data/bin/check-consul-leader.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-consul-leader
|
4
6
|
#
|
@@ -74,11 +76,11 @@ class ConsulStatus < Sensu::Plugin::Check::CLI
|
|
74
76
|
def valid_ip(ip)
|
75
77
|
case ip.to_s
|
76
78
|
when Resolv::IPv4::Regex
|
77
|
-
|
79
|
+
true
|
78
80
|
when Resolv::IPv6::Regex
|
79
|
-
|
81
|
+
true
|
80
82
|
else
|
81
|
-
|
83
|
+
false
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
data/bin/check-consul-members.rb
CHANGED
data/bin/check-consul-servers.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-consul-service-health
|
4
6
|
#
|
@@ -78,20 +80,20 @@ class CheckConsulServiceHealth < Sensu::Plugin::Check::CLI
|
|
78
80
|
services.push(*s['Checks'])
|
79
81
|
end
|
80
82
|
end
|
81
|
-
|
83
|
+
services
|
82
84
|
elsif config[:nodename]
|
83
85
|
data = []
|
84
86
|
begin
|
85
87
|
services = Diplomat::Node.get(config[:nodename]).Services
|
86
|
-
rescue
|
88
|
+
rescue StandardError
|
87
89
|
services = {}
|
88
90
|
end
|
89
|
-
services.
|
91
|
+
services.each_value do |service|
|
90
92
|
Diplomat::Health.checks(service['Service']).each do |check|
|
91
93
|
data.push(check) if check.Node == config[:nodename]
|
92
94
|
end
|
93
95
|
end
|
94
|
-
|
96
|
+
data
|
95
97
|
elsif config[:all]
|
96
98
|
Diplomat::Health.state('any')
|
97
99
|
else
|
@@ -128,8 +130,8 @@ class CheckConsulServiceHealth < Sensu::Plugin::Check::CLI
|
|
128
130
|
'Status' => checkStatus
|
129
131
|
)
|
130
132
|
|
131
|
-
warnings = true if %w
|
132
|
-
criticals = true if %w
|
133
|
+
warnings = true if %w[warning].include? checkStatus
|
134
|
+
criticals = true if %w[critical unknown].include? checkStatus
|
133
135
|
end
|
134
136
|
|
135
137
|
if config[:fail_if_not_found] && !found
|
data/bin/check-service-consul.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-service-consul
|
4
6
|
#
|
@@ -99,18 +101,21 @@ class ServiceStatus < Sensu::Plugin::Check::CLI
|
|
99
101
|
passing = []
|
100
102
|
failing = []
|
101
103
|
data.each do |d|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
104
|
+
if d['Status'] == 'passing'
|
105
|
+
passing << {
|
106
|
+
'node' => d['Node'],
|
107
|
+
'service' => d['ServiceName'],
|
108
|
+
'service_id' => d['ServiceID'],
|
109
|
+
'notes' => d['Notes']
|
110
|
+
}
|
111
|
+
elsif d['Status'] == 'critical'
|
112
|
+
failing << {
|
113
|
+
'node' => d['Node'],
|
114
|
+
'service' => d['ServiceName'],
|
115
|
+
'service_id' => d['ServiceID'],
|
116
|
+
'notes' => d['Notes']
|
117
|
+
}
|
118
|
+
end
|
114
119
|
end
|
115
120
|
|
116
121
|
if failing.empty? && passing.empty?
|
data/lib/sensu-plugins-consul.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-consul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -137,33 +137,33 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '3.2'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: '3.4'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: '3.4'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: rubocop
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 0.51.0
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 0.51.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: yard
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: 2.
|
229
|
+
version: '2.1'
|
230
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
231
|
requirements:
|
232
232
|
- - ">="
|