sensu-plugins-consul 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c684c8753b72679288f5c017f6579c90e8d31df
4
- data.tar.gz: e207203ce031933276ee65fb76a4f185346bf80c
3
+ metadata.gz: 2345bb1e6d0c55e1da7e0be24c383c36f175cf63
4
+ data.tar.gz: 055bf5e5b85fa9842ef806a2efeb071cac89d866
5
5
  SHA512:
6
- metadata.gz: a0625d30e343c886468256e34ecd8f645e2ed277dc40ff5bc5908feed1dd90ebd2edd58d2f6afa23b673b88d70a0b4ef78fdc3cc473587749ea923d3e94d305c
7
- data.tar.gz: 6896136924d366fcce09be182893e172995a31bc974864217217bd8c507467db4f14d3c73dfe6c2788bcb941e042cc45c88fde1dae74f1d97589725c4aa32fac
6
+ metadata.gz: e4f0af653c55e0bc880121a6d83449f4296e88af56406bc43f7880d61431299cc9ff62eb00227b00bb3258429f71c3abd77bf68ebb34a237cc4eea5cdd66b649
7
+ data.tar.gz: 77531f5a5c65a17588d939d26bb413cdfacb9b7ed262cc2554f67603c2cb45d4bc1b7bc50f48bbccbed619b00dcaceaead86e888318217fbc447f9a83ecb2699
@@ -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.4.1...HEAD
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
- puts "Name: #{node['Name']}"
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 'Removed failed consul nodes'
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 'No consul nodes to remove'
77
+ ok 'All nodes are alive'
58
78
  end
59
79
  else
60
80
  critical 'Consul is not responding'
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsConsul
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 4
5
- PATCH = 1
4
+ MINOR = 5
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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.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-06 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin