summaryrefslogtreecommitdiffstats
path: root/plugins/check_tcp.c
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-01-30 05:01:00 (GMT)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-01-30 05:01:00 (GMT)
commite8a3864bca84196a20c6d5566671852b6e80370e (patch)
treea84132a9c264d9b83b1e7dbaa30a209600c613a4 /plugins/check_tcp.c
parent986abfd43d6b2b412c6695c435508eb19db520bb (diff)
downloadmonitoring-plugins-e8a3864bca84196a20c6d5566671852b6e80370e.tar.gz
Fix reporting bug using expect, affecting (not fixing) Debian bug #392610: check_jabber always return warning
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1596 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_tcp.c')
-rw-r--r--plugins/check_tcp.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 7e1bd38..8187bcd 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -347,7 +347,10 @@ main (int argc, char **argv)
347 if(match == -2 && len && !(flags & FLAG_HIDE_OUTPUT)) 347 if(match == -2 && len && !(flags & FLAG_HIDE_OUTPUT))
348 printf("Unexpected response from host/socket: %s", status); 348 printf("Unexpected response from host/socket: %s", status);
349 else { 349 else {
350 printf("%.3f second response time on ", elapsed_time); 350 if(match == -2)
351 printf("Unexpected response from host/socket on ");
352 else
353 printf("%.3f second response time on ", elapsed_time);
351 if(server_address[0] != '/') 354 if(server_address[0] != '/')
352 printf("port %d", server_port); 355 printf("port %d", server_port);
353 else 356 else
@@ -358,17 +361,24 @@ main (int argc, char **argv)
358 printf (" [%s]", status); 361 printf (" [%s]", status);
359 362
360 /* perf-data doesn't apply when server doesn't talk properly, 363 /* perf-data doesn't apply when server doesn't talk properly,
361 * so print all zeroes on warn and crit */ 364 * so print all zeroes on warn and criti. Use fperfdata since
365 * localisation settings can make different outputs */
362 if(match == -2) 366 if(match == -2)
363 printf ("|time=%fs;0.0;0.0;0.0;0.0", elapsed_time); 367 printf ("|%s",
368 fperfdata ("time", elapsed_time, "s",
369 TRUE, 0,
370 TRUE, 0,
371 TRUE, 0,
372 TRUE, socket_timeout)
373 );
364 else 374 else
365 printf("|%s", 375 printf("|%s",
366 fperfdata ("time", elapsed_time, "s", 376 fperfdata ("time", elapsed_time, "s",
367 TRUE, warning_time, 377 TRUE, warning_time,
368 TRUE, critical_time, 378 TRUE, critical_time,
369 TRUE, 0, 379 TRUE, 0,
370 TRUE, socket_timeout) 380 TRUE, socket_timeout)
371 ); 381 );
372 382
373 putchar('\n'); 383 putchar('\n');
374 return result; 384 return result;