bin/check-http.rb in sensu-plugins-http-0.0.2 vs bin/check-http.rb in sensu-plugins-http-0.1.0
- old
+ new
@@ -129,10 +129,17 @@
option :redirectto,
short: '-R URL',
long: '--redirect-to URL',
description: 'Redirect to another page'
+ option :whole_response,
+ short: '-w',
+ long: '--whole-response',
+ boolean: true,
+ default: false,
+ description: 'Print whole output when check fails'
+
option :response_bytes,
short: '-b BYTES',
long: '--response-bytes BYTES',
description: 'Print BYTES of the output',
proc: proc(&:to_i)
@@ -228,13 +235,17 @@
req[h] = v.strip
end
end
res = http.request(req)
- if config[:response_bytes]
- body = "\n" + res.body[0..config[:response_bytes]]
+ if config[:whole_response]
+ body = "\n" + res.body
else
- body = ''
+ if config[:response_bytes]
+ body = "\n" + res.body[0..config[:response_bytes]]
+ else
+ body = ''
+ 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