Просмотр исходного кода

check_http reports warning where it should report ok with -e

Fix for issue #236
John C. Frickson 9 лет назад
Родитель
Сommit
7300528aca
2 измененных файлов с 5 добавлено и 2 удалено
  1. 1 0
      NEWS
  2. 4 2
      plugins/check_http.c

+ 1 - 0
NEWS

@@ -3,6 +3,7 @@ This file documents the major additions and syntax changes between releases.
 x.x.x xxxx-xx-xx
 	FIXES
 	check_users: not accepting zero as the threshold
+	check_http: reports warning where it should report ok with -e
 
 
 2.2.0 2017-01-19

+ 4 - 2
plugins/check_http.c

@@ -1263,12 +1263,14 @@ check_http (void)
   /* server errors result in a critical state */
   else if (http_status >= 500) {
     xasprintf (&msg, _("%s%s - "), msg, status_line);
-    result = STATE_CRITICAL;
+    if (bad_response || !server_expect_yn)
+       result = STATE_CRITICAL;
   }
   /* client errors result in a warning state */
   else if (http_status >= 400) {
     xasprintf (&msg, _("%s%s - "), msg, status_line);
-    result = max_state_alt(STATE_WARNING, result);
+    if (bad_response || !server_expect_yn)
+      result = max_state_alt(STATE_WARNING, result);
   }
   /* check redirected page if specified */
   else if (http_status >= 300) {