sensu-plugins-consul 1.4.1 → 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
- data/CHANGELOG.md +6 -1
- data/bin/check-consul-failures.rb +23 -3
- data/lib/sensu-plugins-consul/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2345bb1e6d0c55e1da7e0be24c383c36f175cf63
|
4
|
+
data.tar.gz: 055bf5e5b85fa9842ef806a2efeb071cac89d866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4f0af653c55e0bc880121a6d83449f4296e88af56406bc43f7880d61431299cc9ff62eb00227b00bb3258429f71c3abd77bf68ebb34a237cc4eea5cdd66b649
|
7
|
+
data.tar.gz: 77531f5a5c65a17588d939d26bb413cdfacb9b7ed262cc2554f67603c2cb45d4bc1b7bc50f48bbccbed619b00dcaceaead86e888318217fbc447f9a83ecb2699
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.5.0] - 2017-08-09
|
9
|
+
### Added
|
10
|
+
- `check-consul-failures` now accepts `--keep-failures` and `--critical` arguments (@psyhomb)
|
11
|
+
|
8
12
|
## [1.4.1] 2017-08-06
|
9
13
|
### Fixed
|
10
14
|
- Bug fix for `check-consul-service-health` [#26](https://github.com/sensu-plugins/sensu-plugins-consul/pull/26) (@psyhomb)
|
@@ -87,7 +91,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
87
91
|
### Added
|
88
92
|
- initial release
|
89
93
|
|
90
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.
|
94
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.5.0...HEAD
|
95
|
+
[1.5.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.4.1...1.5.0
|
91
96
|
[1.4.1]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.4.0...1.4.1
|
92
97
|
[1.4.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.3.0...1.4.0
|
93
98
|
[1.3.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/2.1.0...1.3.0
|
@@ -43,18 +43,38 @@ class ConsulStatus < Sensu::Plugin::Check::CLI
|
|
43
43
|
long: '--scheme SCHEME',
|
44
44
|
default: 'http'
|
45
45
|
|
46
|
+
option :keep_failures,
|
47
|
+
description: 'do not remove failing nodes',
|
48
|
+
short: '-k',
|
49
|
+
long: '--keep-failures',
|
50
|
+
boolean: true,
|
51
|
+
default: false
|
52
|
+
|
53
|
+
option :critical,
|
54
|
+
description: 'set state to critical',
|
55
|
+
short: '-c',
|
56
|
+
long: '--critical',
|
57
|
+
boolean: true,
|
58
|
+
default: false
|
59
|
+
|
46
60
|
def run
|
47
61
|
r = RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}/v1/agent/members", timeout: 5).get
|
48
62
|
if r.code == 200
|
49
63
|
failing_nodes = JSON.parse(r).find_all { |node| node['Status'] == 4 }
|
50
64
|
if !failing_nodes.nil? && !failing_nodes.empty?
|
65
|
+
nodes_names = []
|
51
66
|
failing_nodes.each_entry do |node|
|
52
|
-
|
67
|
+
nodes_names.push(node['Name'])
|
68
|
+
next if config[:keep_failures]
|
69
|
+
puts "Removing failed node: #{node['Name']}"
|
53
70
|
RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}/v1/agent/force-leave/#{node['Name']}", timeout: 5).get
|
71
|
+
nodes_names.delete(node['Name'])
|
54
72
|
end
|
55
|
-
ok '
|
73
|
+
ok 'All clear' if nodes_names.empty?
|
74
|
+
critical "Found failed nodes: #{nodes_names}" if config[:critical]
|
75
|
+
warning "Found failed nodes: #{nodes_names}"
|
56
76
|
else
|
57
|
-
ok '
|
77
|
+
ok 'All nodes are alive'
|
58
78
|
end
|
59
79
|
else
|
60
80
|
critical 'Consul is not responding'
|
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: 1.
|
4
|
+
version: 1.5.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: 2017-08-
|
11
|
+
date: 2017-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|