summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_tcp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 517b6b5..e7342f3 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -289,6 +289,8 @@ main (int argc, char **argv)
289 match_flags)) != NP_MATCH_RETRY) 289 match_flags)) != NP_MATCH_RETRY)
290 break; 290 break;
291 } 291 }
292 if (match == NP_MATCH_RETRY)
293 match = NP_MATCH_FAILURE;
292 294
293 /* no data when expected, so return critical */ 295 /* no data when expected, so return critical */
294 if (len == 0) 296 if (len == 0)
@@ -320,7 +322,7 @@ main (int argc, char **argv)
320 result = STATE_WARNING; 322 result = STATE_WARNING;
321 323
322 /* did we get the response we hoped? */ 324 /* did we get the response we hoped? */
323 if(match != NP_MATCH_SUCCESS && result != STATE_CRITICAL) 325 if(match == NP_MATCH_FAILURE && result != STATE_CRITICAL)
324 result = expect_mismatch_state; 326 result = expect_mismatch_state;
325 327
326 /* reset the alarm */ 328 /* reset the alarm */
@@ -331,10 +333,10 @@ main (int argc, char **argv)
331 * the response we were looking for. if-else */ 333 * the response we were looking for. if-else */
332 printf("%s %s - ", SERVICE, state_text(result)); 334 printf("%s %s - ", SERVICE, state_text(result));
333 335
334 if(match != NP_MATCH_SUCCESS && len && !(flags & FLAG_HIDE_OUTPUT)) 336 if(match == NP_MATCH_FAILURE && len && !(flags & FLAG_HIDE_OUTPUT))
335 printf("Unexpected response from host/socket: %s", status); 337 printf("Unexpected response from host/socket: %s", status);
336 else { 338 else {
337 if(match != NP_MATCH_SUCCESS) 339 if(match == NP_MATCH_FAILURE)
338 printf("Unexpected response from host/socket on "); 340 printf("Unexpected response from host/socket on ");
339 else 341 else
340 printf("%.3f second response time on ", elapsed_time); 342 printf("%.3f second response time on ", elapsed_time);
@@ -344,13 +346,13 @@ main (int argc, char **argv)
344 printf("socket %s", server_address); 346 printf("socket %s", server_address);
345 } 347 }
346 348
347 if (match == NP_MATCH_SUCCESS && !(flags & FLAG_HIDE_OUTPUT) && len) 349 if (match != NP_MATCH_FAILURE && !(flags & FLAG_HIDE_OUTPUT) && len)
348 printf (" [%s]", status); 350 printf (" [%s]", status);
349 351
350 /* perf-data doesn't apply when server doesn't talk properly, 352 /* perf-data doesn't apply when server doesn't talk properly,
351 * so print all zeroes on warn and crit. Use fperfdata since 353 * so print all zeroes on warn and crit. Use fperfdata since
352 * localisation settings can make different outputs */ 354 * localisation settings can make different outputs */
353 if(match != NP_MATCH_SUCCESS) 355 if(match == NP_MATCH_FAILURE)
354 printf ("|%s", 356 printf ("|%s",
355 fperfdata ("time", elapsed_time, "s", 357 fperfdata ("time", elapsed_time, "s",
356 (flags & FLAG_TIME_WARN ? TRUE : FALSE), 0, 358 (flags & FLAG_TIME_WARN ? TRUE : FALSE), 0,