sensu-plugins-consul 1.5.0 → 1.6.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: 2345bb1e6d0c55e1da7e0be24c383c36f175cf63
4
- data.tar.gz: 055bf5e5b85fa9842ef806a2efeb071cac89d866
3
+ metadata.gz: 37de5f7368c756f09131aff39b3409ecda71d57c
4
+ data.tar.gz: db8e94806d56bc3844379c1e01f94b45d3dacae4
5
5
  SHA512:
6
- metadata.gz: e4f0af653c55e0bc880121a6d83449f4296e88af56406bc43f7880d61431299cc9ff62eb00227b00bb3258429f71c3abd77bf68ebb34a237cc4eea5cdd66b649
7
- data.tar.gz: 77531f5a5c65a17588d939d26bb413cdfacb9b7ed262cc2554f67603c2cb45d4bc1b7bc50f48bbccbed619b00dcaceaead86e888318217fbc447f9a83ecb2699
6
+ metadata.gz: 31b2888eb681e8e503cf45971abd75362bf8f8b6617a1f47bfc5045f0e21ac7e9b408ae3a9674ee701696b5fcfcd62bb3130df54627d2ef40f7691ad294a0300
7
+ data.tar.gz: e4d1bd13acfba24dddef6853cc3653f5e392d054c986b4de77d1d125d1f1322ccc8283613d5cfbaada85fd312b80994822644975eb24c1b8fad9f322bd18ddd9
@@ -1,10 +1,17 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.6.0] - 2017-09-30
9
+ ### Added
10
+ - `check-consul-leader`, `check-consul-members`, and `check-consul-servers` now accept `--insecure`, `--capath`, `--timeout` arguments (@akatch)
11
+
12
+ ### Changed
13
+ - update Changelog guideline location (@majormoses)
14
+
8
15
  ## [1.5.0] - 2017-08-09
9
16
  ### Added
10
17
  - `check-consul-failures` now accepts `--keep-failures` and `--critical` arguments (@psyhomb)
@@ -91,7 +98,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
91
98
  ### Added
92
99
  - initial release
93
100
 
94
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.5.0...HEAD
101
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.6.0...HEAD
102
+ [1.6.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.5.0...1.6.0
95
103
  [1.5.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.4.1...1.5.0
96
104
  [1.4.1]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.4.0...1.4.1
97
105
  [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-consul/compare/1.3.0...1.4.0
@@ -53,6 +53,24 @@ class ConsulStatus < Sensu::Plugin::Check::CLI
53
53
  long: '--scheme SCHEME',
54
54
  default: 'http'
55
55
 
56
+ option :insecure,
57
+ description: 'set this flag to disable SSL verification',
58
+ short: '-k',
59
+ long: '--insecure',
60
+ boolean: true,
61
+ default: false
62
+
63
+ option :capath,
64
+ description: 'absolute path to an alternative CA file',
65
+ short: '-c CAPATH',
66
+ long: '--capath CAPATH'
67
+
68
+ option :timeout,
69
+ description: 'connection will time out after this many seconds',
70
+ short: '-t TIMEOUT_IN_SECONDS',
71
+ long: '--timeout TIMEOUT_IN_SECONDS',
72
+ default: 5
73
+
56
74
  def valid_ip(ip)
57
75
  case ip.to_s
58
76
  when Resolv::IPv4::Regex
@@ -77,7 +95,13 @@ class ConsulStatus < Sensu::Plugin::Check::CLI
77
95
  end
78
96
 
79
97
  def run
80
- r = RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}/v1/status/leader", timeout: 5).get
98
+ options = { timeout: config[:timeout],
99
+ verify_ssl: (OpenSSL::SSL::VERIFY_NONE if defined? config[:insecure]),
100
+ ssl_ca_file: (config[:capath] if defined? config[:capath]) }
101
+ url = "#{config[:scheme]}://#{config[:server]}:#{config[:port]}/v1/status/leader"
102
+
103
+ r = RestClient::Resource.new(url, options).get
104
+
81
105
  if r.code == 200
82
106
  if valid_ip(strip_ip(r.body))
83
107
  ok 'Consul is UP and has a leader'
@@ -74,12 +74,35 @@ class ConsulStatus < Sensu::Plugin::Check::CLI
74
74
  long: '--scheme SCHEME',
75
75
  default: 'http'
76
76
 
77
+ option :insecure,
78
+ description: 'if set, disables SSL verification',
79
+ short: '-k',
80
+ long: '--insecure',
81
+ boolean: true,
82
+ default: false
83
+
84
+ option :capath,
85
+ description: 'absolute path to an alternate CA file',
86
+ short: '-c CAPATH',
87
+ long: '--capath CAPATH'
88
+
89
+ option :timeout,
90
+ description: 'connection will time out after this many seconds',
91
+ short: '-t TIMEOUT_IN_SECONDS',
92
+ long: '--timeout TIMEOUT_IN_SECONDS',
93
+ default: 5
94
+
77
95
  def run
78
96
  url = "#{config[:scheme]}://#{config[:server]}:#{config[:port]}/v1/agent/members"
97
+ options = { timeout: config[:timeout],
98
+ verify_ssl: (OpenSSL::SSL::VERIFY_NONE if defined? config[:insecure]),
99
+ ssl_ca_file: (config[:capath] if defined? config[:capath]) }
100
+
79
101
  if config[:wan]
80
102
  url += '?wan=1'
81
103
  end
82
- json = RestClient::Resource.new(url, timeout: 5).get
104
+
105
+ json = RestClient::Resource.new(url, options).get
83
106
  peers = 0
84
107
  members = JSON.parse(json)
85
108
  members.each do |member|
@@ -65,8 +65,31 @@ class ConsulStatus < Sensu::Plugin::Check::CLI
65
65
  long: '--scheme SCHEME',
66
66
  default: 'http'
67
67
 
68
+ option :insecure,
69
+ description: 'if set, disables SSL verification',
70
+ short: '-k',
71
+ long: '--insecure',
72
+ boolean: true,
73
+ default: false
74
+
75
+ option :capath,
76
+ description: 'absolute path to an alternate CA file',
77
+ short: '-c CAPATH',
78
+ long: '--capath CAPATH'
79
+
80
+ option :timeout,
81
+ description: 'connection will time out after this many seconds',
82
+ short: '-t TIMEOUT_IN_SECONDS',
83
+ long: '--timeout TIMEOUT_IN_SECONDS',
84
+ default: 5
85
+
68
86
  def run
69
- json = RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}/v1/status/peers", timeout: 5).get
87
+ url = "#{config[:scheme]}://#{config[:server]}:#{config[:port]}/v1/status/peers"
88
+ options = { timeout: config[:timeout],
89
+ verify_ssl: (OpenSSL::SSL::VERIFY_NONE if defined? config[:insecure]),
90
+ ssl_ca_file: (config[:capath] if defined? config[:capath]) }
91
+
92
+ json = RestClient::Resource.new(url, options).get
70
93
  peers = JSON.parse(json).length.to_i
71
94
  if peers < config[:min].to_i
72
95
  critical "[#{peers}] peers is below critical threshold of [#{config[:min]}]"
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsConsul
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 5
4
+ MINOR = 6
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
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.5.0
4
+ version: 1.6.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-09 00:00:00.000000000 Z
11
+ date: 2017-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  requirements: []
236
236
  rubyforge_project:
237
- rubygems_version: 2.4.5
237
+ rubygems_version: 2.6.13
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: Sensu plugins for Consul