sensu-plugins-http 2.10.0 → 2.11.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
  SHA256:
3
- metadata.gz: f7ad8cff5dc35071f986cfa1045f3975c8ffbddfc85df368913c9ec5c69519ec
4
- data.tar.gz: 3eb9c03bed43c24a5087041169fc76dc06251d0e5a11a7a5ac401a8296462a3a
3
+ metadata.gz: ee65bed5670246b5af15d48460ed5cd47f08190ea3cb84be81e1a29baf468815
4
+ data.tar.gz: 2581a8b459e0554cdb6939716dec864b0c60ffbdfcb2d0f8fe7b6b6ce3f79253
5
5
  SHA512:
6
- metadata.gz: 07956574d712f483e036d5ceecf2d1ac13d4557467ea63e2a799b9814febd9b40bf0f12810ce0c4db02e13fd7cc9f2897536bb2e9eb0b5cad09f6973975db046
7
- data.tar.gz: 2b2d8c0a3e995aee4bcec18caff9d8eed00885b2f48277f5757731252a7009c65ffaa8f8c7e89eb1562a09854f3cee2b7bdce9a90d6c6b94e17a95cb433b11ba
6
+ metadata.gz: 4bc5dfdcf0417dbea0ad6c9a34c9a0f6529489888e85761b8ec586da75c3b1f789b29a3cccfe87ae25fd2c70b68ab6631e395ca75dd6a5293e0788034f6362fc
7
+ data.tar.gz: 603dcac8c82f736761c387a1a646ae5393ac0a66a940519ba6c9863525e6d36a1c1c18d0aed62fabe126b5d3d5761be5a0d75d566f6ff6777a8ea4e550d69910
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.11.0] - 2018-06-04
9
+ ### Added
10
+ - `check-http-json.rb`: add option `--response-code` for checking the HTTP response code
11
+ - `check-http.rb`: modify option `--response-code` to accept a regex
12
+
8
13
  ## [2.10.0] - 2018-05-23
9
14
  ### Added
10
15
  - `check-http.rb`: add option `--min-bytes` to check if a response is greater than minimum specified value (@lisfo4ka)
@@ -193,7 +198,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
193
198
  ### Added
194
199
  - Initial release
195
200
 
196
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.10.0...HEAD
201
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.11.0...HEAD
202
+ [2.11.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.10.0...2.11.0
197
203
  [2.10.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.9.0...2.10.0
198
204
  [2.9.0]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.8.4...2.9.0
199
205
  [2.8.4]: https://github.com/sensu-plugins/sensu-plugins-http/compare/2.8.3...2.8.4
@@ -74,6 +74,11 @@ class CheckJson < Sensu::Plugin::Check::CLI
74
74
  option :dump_json, short: '-d', long: '--dump-json', boolean: true, default: false
75
75
  option :pretty, long: '--pretty', boolean: true, default: false
76
76
 
77
+ option :response_code,
78
+ long: '--response-code REGEX',
79
+ description: 'Critical if HTTP response code does not match REGEX',
80
+ default: '^2([0-9]{2})$'
81
+
77
82
  def run
78
83
  if config[:url]
79
84
  uri = URI.parse(config[:url])
@@ -182,7 +187,7 @@ class CheckJson < Sensu::Plugin::Check::CLI
182
187
  end
183
188
  res = http.request(req)
184
189
 
185
- unless res.code =~ /^2/
190
+ if res.code !~ /#{config[:response_code]}/
186
191
  critical "http code: #{res.code}: body: #{res.body}" if config[:whole_response]
187
192
  critical res.code
188
193
  end
data/bin/check-http.rb CHANGED
@@ -205,8 +205,8 @@ class CheckHttp < Sensu::Plugin::Check::CLI
205
205
  proc: proc(&:to_i)
206
206
 
207
207
  option :response_code,
208
- long: '--response-code CODE',
209
- description: 'Check for a specific response code'
208
+ long: '--response-code REGEX',
209
+ description: 'Critical if HTTP response code does not match REGEX'
210
210
 
211
211
  option :proxy_url,
212
212
  long: '--proxy-url PROXY_URL',
@@ -408,7 +408,7 @@ class CheckHttp < Sensu::Plugin::Check::CLI
408
408
  warning(res.code + body) unless config[:response_code]
409
409
  end
410
410
 
411
- if config[:response_code] && config[:response_code] == res.code
411
+ if config[:response_code] && res.code =~ /#{config[:response_code]}/
412
412
  ok "#{res.code}, #{size} bytes" + body
413
413
 
414
414
  else
@@ -3,7 +3,7 @@
3
3
  module SensuPluginsHttp
4
4
  module Version
5
5
  MAJOR = 2
6
- MINOR = 10
6
+ MINOR = 11
7
7
  PATCH = 0
8
8
 
9
9
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.11.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-05-23 00:00:00.000000000 Z
11
+ date: 2018-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin