From c69ad4be1c6937acf8cc0e08123ca8392bc3306a Mon Sep 17 00:00:00 2001 From: Gerhard Lausser Date: Thu, 8 Oct 2020 14:08:15 +0200 Subject: [PATCH] expected response code can be a comma-separated list of codes --- README.md | 2 +- check_curly | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0bfe0c7..a33ea4b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ On Debian or Ubuntu install those packages: -f Follow redirects -k Ignore SSL certificate errors - -e Expected HTTP response code [HTTP_RESPONSE_CODE] + -e Expected HTTP response code [HTTP_RESPONSE_CODE[,HTTP_RESPONSE_CODE,...]] --proxy Proxy [http://PROXY:PORT] --agent Agent [USER_AGENT] diff --git a/check_curly b/check_curly index 1b2c89f..707f7c5 100755 --- a/check_curly +++ b/check_curly @@ -15,7 +15,7 @@ Originally written by Vit Safar, extended by Michael Kraus -f Follow redirects -k Ignore SSL certificate errors - -e Expected HTTP response code [HTTP_RESPONSE_CODE] + -e Expected HTTP response code [HTTP_RESPONSE_CODE[,HTTP_RESPONSE_CODE,...]] --proxy Proxy [http://PROXY:PORT] --agent Agent [USER_AGENT] @@ -363,7 +363,7 @@ $body if (isset($Expected)) { - if ($http_code != $Expected) { + if (! in_array($http_code, explode(",", $Expected))) { $Msg.='CRITICAL http_response code '.$http_code.' does not match expected '.$Expected; nagios_exit(2); }