diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 7e1bd38b043be9059075803aa1fd33ec1c192dd9..a977077c3fce99b0586d0f697b22c29299d0c382 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
len = strlen(progname);
if(len > 6 && !memcmp(progname, "check_", 6)) {
- SERVICE = progname + 6;
+ SERVICE = strdup(progname + 6);
for(i = 0; i < len - 6; i++)
SERVICE[i] = toupper(SERVICE[i]);
}
}
else if (!strncmp(SERVICE, "JABBER", 6)) {
SEND = "<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n";
- EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'";
+ EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'";
QUIT = "</stream:stream>\n";
- flags |= FLAG_SSL | FLAG_HIDE_OUTPUT;
+ flags |= FLAG_HIDE_OUTPUT;
PORT = 5222;
}
else if (!strncmp (SERVICE, "NNTPS", 5)) {
/* this is a bit stupid, because we don't want to print the
* response time (which can look ok to the user) if we didn't get
* the response we were looking for. if-else */
- printf(_("%s %s - "), SERVICE, state_text(result));
+ printf("%s %s - ", SERVICE, state_text(result));
if(match == -2 && len && !(flags & FLAG_HIDE_OUTPUT))
printf("Unexpected response from host/socket: %s", status);
else {
- printf("%.3f second response time on ", elapsed_time);
+ if(match == -2)
+ printf("Unexpected response from host/socket on ");
+ else
+ printf("%.3f second response time on ", elapsed_time);
if(server_address[0] != '/')
printf("port %d", server_port);
else
printf (" [%s]", status);
/* perf-data doesn't apply when server doesn't talk properly,
- * so print all zeroes on warn and crit */
+ * so print all zeroes on warn and crit. Use fperfdata since
+ * localisation settings can make different outputs */
if(match == -2)
- printf ("|time=%fs;0.0;0.0;0.0;0.0", elapsed_time);
+ printf ("|%s",
+ fperfdata ("time", elapsed_time, "s",
+ (flags & FLAG_TIME_WARN ? TRUE : FALSE), 0,
+ (flags & FLAG_TIME_CRIT ? TRUE : FALSE), 0,
+ TRUE, 0,
+ TRUE, socket_timeout)
+ );
else
printf("|%s",
fperfdata ("time", elapsed_time, "s",
- TRUE, warning_time,
- TRUE, critical_time,
- TRUE, 0,
- TRUE, socket_timeout)
- );
+ (flags & FLAG_TIME_WARN ? TRUE : FALSE), warning_time,
+ (flags & FLAG_TIME_CRIT ? TRUE : FALSE), critical_time,
+ TRUE, 0,
+ TRUE, socket_timeout)
+ );
putchar('\n');
return result;
{"expect", required_argument, 0, 'e'},
{"maxbytes", required_argument, 0, 'm'},
{"quit", required_argument, 0, 'q'},
- {"jail", required_argument, 0, 'j'},
+ {"jail", no_argument, 0, 'j'},
{"delay", required_argument, 0, 'd'},
{"refuse", required_argument, 0, 'r'},
{"mismatch", required_argument, 0, 'M'},
if (server_address == NULL)
usage4 (_("You must provide a server address"));
else if (server_address[0] != '/' && is_host (server_address) == FALSE)
- die (STATE_CRITICAL, "%s: %s - %s\n", progname, _("Invalid hostname, address or socket"), server_address);
+ die (STATE_CRITICAL, "%s %s - %s: %s\n", SERVICE, state_text(STATE_CRITICAL), _("Invalid hostname, address or socket"), server_address);
return TRUE;
}
printf (_(UT_IPv46));
printf (" %s\n", "-E, --escape");
- printf (" %s\n", _("Can use \\n, \\r, \\t or \\ in send or quit string."));
+ printf (" %s\n", _("Can use \\n, \\r, \\t or \\ in send or quit string. Must come before send or quit option"));
printf (" %s\n", _("Default: nothing added to send, \\r\\n added to end of quit"));
printf (" %s\n", "-s, --send=STRING");
printf (" %s\n", _("String to send to the server"));