bin/check-http.rb in sensu-plugins-http-2.9.0 vs bin/check-http.rb in sensu-plugins-http-2.10.0

- old
+ new

@@ -22,10 +22,13 @@ # check-http.rb -u http://my.site.com # # Pattern check - expect a 200 response and the string 'OK' in the body # check-http.rb -u http://my.site.com/health -q 'OK' # +# Check if a response is greater than the specified minimum value +# check-http.rb -u https://my.site.com/redirect --min-bytes 10 +# # Check response code - expect a 301 response # check-http.rb -u https://my.site.com/redirect --response-code 301 -r # # Use a proxy to check a URL # check-http.rb -u https://www.google.com --proxy-url http://my.proxy.com:3128 @@ -193,10 +196,16 @@ short: '-B BYTES', long: '--require-bytes BYTES', description: 'Check the response contains exactly BYTES bytes', proc: proc(&:to_i) + option :min_bytes, + short: '-g BYTES', + 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' option :proxy_url, @@ -334,9 +343,13 @@ end end if config[:require_bytes] && res.body.length != config[:require_bytes] critical "Response was #{res.body.length} bytes instead of #{config[:require_bytes]}" + body + end + + if config[:min_bytes] && res.body.length < config[:min_bytes] + critical "Response was #{res.body.length} bytes instead of the indicated minimum #{config[:min_bytes]}" + body end unless warn_cert_expire.nil? warning "Certificate will expire #{warn_cert_expire}" end