diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 6daa1a11bd60128d1206cfe93bba730cb272bc91..f31c9c61b6984536e7a872030cdd1f1593b6b7a4 100644 (file)
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
*****************************************************************************/
const char *progname = "check_by_ssh";
const char *revision = "$Revision$";
-const char *copyright = "2000-2003";
+const char *copyright = "2000-2004";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
/* process arguments */
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
-
+ usage4 (_("Could not parse arguments"));
/* Set signal handling and alarm timeout */
if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
- printf (_("Cannot catch SIGALRM"));
- return STATE_UNKNOWN;
+ usage4 (_("Cannot catch SIGALRM"));
}
alarm (timeout_interval);
-
/* run the command */
if (verbose)
switch (c) {
case '?': /* help */
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
print_usage ();
exit (STATE_UNKNOWN);
case 'V': /* version */
- print_revision (progname, "$Revision$");
+ print_revision (progname, revision);
exit (STATE_OK);
case 'h': /* help */
print_help ();
break;
case 'H': /* host */
if (!is_host (optarg))
- usage2 (_("Invalid hostname/adress"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
hostname = optarg;
break;
case 'p': /* port number */
if (!is_integer (optarg))
- usage2 (_("port must be a positive integer"), optarg);
+ usage2 (_("Port must be a positive integer"), optarg);
asprintf (&comm,"%s -p %s", comm, optarg);
break;
case 'O': /* output file */
if (c <= argc) {
die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname);
} else if (!is_host (argv[c]))
- die (STATE_UNKNOWN, "%s: %s %s\n", progname, _("Invalid host name"), argv[c]);
+ die (STATE_UNKNOWN, "%s: %s %s\n", progname, _("Invalid hostname/address"), argv[c]);
hostname = argv[c++];
}
asprintf (&remotecmd, "%s;echo STATUS CODE: $?;", remotecmd);
if (remotecmd == NULL || strlen (remotecmd) <= 1)
- usage (_("No remotecmd\n"));
+ usage4 (_("No remotecmd"));
asprintf (&comm, "%s %s '%s'", comm, hostname, remotecmd);
-
-
int
validate_arguments (void)
{
{
print_revision (progname, revision);
- printf (_("Copyright (c) 1999 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"));
- printf (_(COPYRIGHT), copyright, email);
+ printf ("Copyright (c) 1999 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n");
+ printf (COPYRIGHT, copyright, email);
printf (_("This plugin uses SSH to execute commands on a remote host\n\n"));
all of -O, -s, and -n options (servicelist order must match '-C'\n\
options)\n"));
- printf (_("\n\
+ printf ("\n\
$ check_by_ssh -H localhost -n lh -s c1:c2:c3 \\\n\
-C uptime -C uptime -C uptime -O /tmp/foo\n\
$ cat /tmp/foo\n\
[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days...\n\
[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days...\n\
-[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days...\n"));
+[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days...\n");
printf (_(UT_SUPPORT));
}
-
-
void
print_usage (void)
{
- printf (_("\n\
-Usage: %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> \n\
- -C <command> [-n name] [-s servicelist] [-O outputfile] [-p port]\n"),
- progname);
- printf (_(UT_HLP_VRS), progname, progname);
+ printf ("\n\
+Usage: %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>\n\
+ [-n name] [-s servicelist] [-O outputfile] [-p port]\n", progname);
}