From a5973eb2c293f88fdba6721bfdd3fa4d5a2e53ed Mon Sep 17 00:00:00 2001 From: Andreas Paul Date: Mon, 16 Aug 2021 17:47:08 +0200 Subject: [PATCH] allow non 200 HTTP return code to be OK, fixes #48 --- check_http_json.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/check_http_json.rb b/check_http_json.rb index c929f1e..66f982d 100755 --- a/check_http_json.rb +++ b/check_http_json.rb @@ -224,8 +224,10 @@ def uri_target(options) end end end - msg = 'Received HTTP code %s instead of 200.' % [response.code] - Nagios.do_exit(level.to_i, msg) + if not level == 0 then + msg = 'Received HTTP code %s instead of 200.' % [response.code] + Nagios.do_exit(level.to_i, msg) + end end say(options[:v], "RESPONSE:\n---\n%s\n---" % [response.body])