diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 7e4700967fbaf3fadee9eac8174b99f6caad2e54..178bd5688dec52abeeb72667b595ba7c65709ab5 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
/*****************************************************************************
-*
+*
* Nagios check_tcp plugin
-*
+*
* License: GPL
-* Copyright (c) 1999-2006 nagios-plugins team
-*
-* Last Modified: $Date$
-*
+* Copyright (c) 1999-2008 Nagios Plugins Development Team
+*
* Description:
-*
+*
* This file contains the check_tcp plugin
-*
-* License Information:
-*
-* This program is free software; you can redistribute it and/or modify
+*
+*
+* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
+* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id$
*
/* progname "check_tcp" changes depending on symlink called */
char *progname;
-const char *revision = "$Revision$";
-const char *copyright = "1999-2006";
+const char *copyright = "1999-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
server_quit = QUIT;
status = NULL;
+ /* Parse extra opts if any */
+ argv=np_extra_opts (&argc, argv, progname);
+
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
}
#ifdef HAVE_SSL
np_net_ssl_cleanup();
-#endif
+#endif
if (sd) close (sd);
microsec = deltime (tv);
{"critical-codes", required_argument, 0, 'C'},
{"warning-codes", required_argument, 0, 'W'},
{"timeout", required_argument, 0, 't'},
- {"protocol", required_argument, 0, 'P'},
+ {"protocol", required_argument, 0, 'P'}, /* FIXME: Unhandled */
{"port", required_argument, 0, 'p'},
- {"escape", required_argument, 0, 'E'},
- {"all", required_argument, 0, 'A'},
+ {"escape", no_argument, 0, 'E'},
+ {"all", no_argument, 0, 'A'},
{"send", required_argument, 0, 's'},
{"expect", required_argument, 0, 'e'},
{"maxbytes", required_argument, 0, 'm'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"help", no_argument, 0, 'h'},
-#ifdef HAVE_SSL
{"ssl", no_argument, 0, 'S'},
{"certificate", required_argument, 0, 'D'},
-#endif
{0, 0, 0, 0}
};
print_help ();
exit (STATE_OK);
case 'V': /* version */
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
exit (STATE_OK);
case 'v': /* verbose mode */
flags |= FLAG_VERBOSE;
if (server_address == NULL)
usage4 (_("You must provide a server address"));
else if (server_address[0] != '/' && is_host (server_address) == FALSE)
- die (STATE_UNKNOWN, "%s %s - %s: %s\n", SERVICE, state_text(STATE_UNKNOWN), _("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;
}
void
print_help (void)
{
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
printf (COPYRIGHT, copyright, email);
print_usage ();
- printf (_(UT_HELP_VRSN));
+ printf (UT_HELP_VRSN);
+ printf (UT_EXTRA_OPTS);
- printf (_(UT_HOST_PORT), 'p', "none");
+ printf (UT_HOST_PORT, 'p', "none");
- printf (_(UT_IPv46));
+ printf (UT_IPv46);
printf (" %s\n", "-E, --escape");
printf (" %s\n", _("Can use \\n, \\r, \\t or \\ in send or quit string. Must come before send or quit option"));
printf (" %s\n", "-q, --quit=STRING");
printf (" %s\n", _("String to send server to initiate a clean close of the connection"));
printf (" %s\n", "-r, --refuse=ok|warn|crit");
- printf (" %s\n", _("Accept tcp refusals with states ok, warn, crit (default: crit)"));
+ printf (" %s\n", _("Accept TCP refusals with states ok, warn, crit (default: crit)"));
printf (" %s\n", "-M, --mismatch=ok|warn|crit");
printf (" %s\n", _("Accept expected string mismatches with states ok, warn, crit (default: warn)"));
printf (" %s\n", "-j, --jail");
printf (" %s\n", _("Use SSL for the connection."));
#endif
- printf (_(UT_WARN_CRIT));
+ printf (UT_WARN_CRIT);
- printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
- printf (_(UT_VERBOSE));
+ printf (UT_VERBOSE);
- printf (_(UT_SUPPORT));
+ printf (UT_SUPPORT);
}
void
print_usage (void)
{
- printf (_("Usage:"));
+ printf ("%s\n", _("Usage:"));
printf ("%s -H host -p port [-w <warning time>] [-c <critical time>] [-s <send string>]\n",progname);
printf ("[-e <expect string>] [-q <quit string>][-m <maximum bytes>] [-d <delay>]\n");
printf ("[-t <timeout seconds>] [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n");