summaryrefslogtreecommitdiffstats
path: root/plugins/check_by_ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_by_ssh.c')
-rw-r--r--plugins/check_by_ssh.c96
1 files changed, 43 insertions, 53 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 75369ec6..b1688d0e 100644
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
@@ -20,7 +20,7 @@
20 20
21const char *progname = "check_by_ssh"; 21const char *progname = "check_by_ssh";
22const char *revision = "$Revision$"; 22const char *revision = "$Revision$";
23const char *copyright = "2000-2004"; 23const char *copyright = "2000-2006";
24const char *email = "nagiosplug-devel@lists.sourceforge.net"; 24const char *email = "nagiosplug-devel@lists.sourceforge.net";
25 25
26#include "common.h" 26#include "common.h"
@@ -299,8 +299,10 @@ print_help (void)
299 printf ("Copyright (c) 1999 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"); 299 printf ("Copyright (c) 1999 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n");
300 printf (COPYRIGHT, copyright, email); 300 printf (COPYRIGHT, copyright, email);
301 301
302 printf (_("This plugin uses SSH to execute commands on a remote host\n\n")); 302 printf (_("This plugin uses SSH to execute commands on a remote host"));
303 303
304 printf ("\n\n");
305
304 print_usage (); 306 print_usage ();
305 307
306 printf (_(UT_HELP_VRSN)); 308 printf (_(UT_HELP_VRSN));
@@ -309,56 +311,44 @@ print_help (void)
309 311
310 printf (_(UT_IPv46)); 312 printf (_(UT_IPv46));
311 313
312 printf (_("\ 314 printf (" %s\n", "-1, --proto1");
313 -1, --proto1\n\ 315 printf (" %s\n", _("tell ssh to use Protocol 1"));
314 tell ssh to use Protocol 1\n\ 316 printf (" %s\n", "-2, --proto2");
315 -2, --proto2\n\ 317 printf (" %s\n", _("tell ssh to use Protocol 2"));
316 tell ssh to use Protocol 2\n\ 318 printf (" %s\n", "-S, --skiplines=n");
317 -S, --skiplines=n\n\ 319 printf (" %s\n", _("Ignore first n lines on STDERR (to suppress a logon banner)"));
318 Ignore first n lines on STDERR (to suppress a logon banner)\n\ 320 printf (" %s\n", "-f");
319 -f\n\ 321 printf (" %s\n", _("tells ssh to fork rather than create a tty"));
320 tells ssh to fork rather than create a tty\n")); 322 printf (" %s\n","-C, --command='COMMAND STRING'");
321 323 printf (" %s\n", _("command to execute on the remote machine"));
322 printf (_("\ 324 printf (" %s\n","-l, --logname=USERNAME");
323 -C, --command='COMMAND STRING'\n\ 325 printf (" %s\n", _("SSH user name on remote host [optional]"));
324 command to execute on the remote machine\n\ 326 printf (" %s\n","-i, --identity=KEYFILE");
325 -l, --logname=USERNAME\n\ 327 printf (" %s\n", _("identity of an authorized key [optional]"));
326 SSH user name on remote host [optional]\n\ 328 printf (" %s\n","-O, --output=FILE");
327 -i, --identity=KEYFILE\n\ 329 printf (" %s\n", _("external command file for nagios [optional]"));
328 identity of an authorized key [optional]\n\ 330 printf (" %s\n","-s, --services=LIST");
329 -O, --output=FILE\n\ 331 printf (" %s\n", _("list of nagios service names, separated by ':' [optional]"));
330 external command file for nagios [optional]\n\ 332 printf (" %s\n","-n, --name=NAME");
331 -s, --services=LIST\n\ 333 printf (" %s\n", _("short name of host in nagios configuration [optional]"));
332 list of nagios service names, separated by ':' [optional]\n\
333 -n, --name=NAME\n\
334 short name of host in nagios configuration [optional]\n"));
335
336 printf (_(UT_WARN_CRIT)); 334 printf (_(UT_WARN_CRIT));
337
338 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); 335 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
339 336 printf (" %s\n", _("The most common mode of use is to refer to a local identity file with"));
340 printf (_("\n\ 337 printf (" %s\n", _("the '-i' option. In this mode, the identity pair should have a null"));
341The most common mode of use is to refer to a local identity file with\n\ 338 printf (" %s\n", _("passphrase and the public key should be listed in the authorized_keys"));
342the '-i' option. In this mode, the identity pair should have a null\n\ 339 printf (" %s\n", _("file of the remote host. Usually the key will be restricted to running"));
343passphrase and the public key should be listed in the authorized_keys\n\ 340 printf (" %s\n", _("only one command on the remote server. If the remote SSH server tracks"));
344file of the remote host. Usually the key will be restricted to running\n\ 341 printf (" %s\n", _("invocation arguments, the one remote program may be an agent that can"));
345only one command on the remote server. If the remote SSH server tracks\n\ 342 printf (" %s\n", _("execute additional commands as proxy"));
346invocation arguments, the one remote program may be an agent that can\n\ 343 printf (" %s\n", _("To use passive mode, provide multiple '-C' options, and provide"));
347execute additional commands as proxy\n")); 344 printf (" %s\n", _("all of -O, -s, and -n options (servicelist order must match '-C'options)"));
348 345 printf ("\n");
349 printf (_("\n\ 346 printf ("%s\n", _("Examples:"));
350To use passive mode, provide multiple '-C' options, and provide\n\ 347 printf (" %s\n", "$ check_by_ssh -H localhost -n lh -s c1:c2:c3 -C uptime -C uptime -C uptime -O /tmp/foo");
351all of -O, -s, and -n options (servicelist order must match '-C'\n\ 348 printf (" %s\n", "$ cat /tmp/foo");
352options)\n")); 349 printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days");
353 350 printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days");
354 printf ("\n\ 351 printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days");
355$ check_by_ssh -H localhost -n lh -s c1:c2:c3 \\\n\
356 -C uptime -C uptime -C uptime -O /tmp/foo\n\
357$ cat /tmp/foo\n\
358[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days...\n\
359[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days...\n\
360[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days...\n");
361
362 printf (_(UT_SUPPORT)); 352 printf (_(UT_SUPPORT));
363} 353}
364 354
@@ -367,7 +357,7 @@ $ cat /tmp/foo\n\
367void 357void
368print_usage (void) 358print_usage (void)
369{ 359{
370 printf ("\n\ 360 printf (_("Usage:"));
371Usage: %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>\n\ 361 printf(" %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname);
372 [-n name] [-s servicelist] [-O outputfile] [-p port]\n", progname); 362 printf(" [-n name] [-s servicelist] [-O outputfile] [-p port]\n");
373} 363}