bin/check-http.rb in sensu-plugins-http-2.10.0 vs bin/check-http.rb in sensu-plugins-http-2.11.0
- old
+ new
@@ -203,12 +203,12 @@
long: '--min-bytes BYTES',
description: 'Check the response contains at least BYTES bytes',
proc: proc(&:to_i)
option :response_code,
- long: '--response-code CODE',
- description: 'Check for a specific response code'
+ long: '--response-code REGEX',
+ description: 'Critical if HTTP response code does not match REGEX'
option :proxy_url,
long: '--proxy-url PROXY_URL',
description: 'Use a proxy server to connect'
@@ -406,10 +406,10 @@
critical(res.code + body) unless config[:response_code]
else
warning(res.code + body) unless config[:response_code]
end
- if config[:response_code] && config[:response_code] == res.code
+ if config[:response_code] && res.code =~ /#{config[:response_code]}/
ok "#{res.code}, #{size} bytes" + body
else
critical res.code + body
end