[Nagiosplug-checkins] nagiosplug/plugins check_by_ssh.c,1.39,1.40

Holger Weiß hweiss at users.sourceforge.net
Mon Jan 22 05:05:39 CET 2007


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv32137

Modified Files:
	check_by_ssh.c 
Log Message:
Added "-o,--ssh-option=OPTION" which hands "-o OPTION" over to ssh(1) and
"-q,--quiet" which tells ssh(1) to suppress warnings (Gerhard Lausser - 1472491)


Index: check_by_ssh.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_by_ssh.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- check_by_ssh.c	19 Oct 2006 00:25:16 -0000	1.39
+++ check_by_ssh.c	22 Jan 2007 04:05:37 -0000	1.40
@@ -166,6 +166,8 @@
 		{"proto2", no_argument, 0, '2'},
 		{"use-ipv4", no_argument, 0, '4'},
 		{"use-ipv6", no_argument, 0, '6'},
+		{"ssh-option", required_argument, 0, 'o'},
+		{"quiet", no_argument, 0, 'q'},
 		{0, 0, 0, 0}
 	};
 
@@ -177,7 +179,7 @@
 			strcpy (argv[c], "-t");
 
 	while (1) {
-		c = getopt_long (argc, argv, "Vvh1246ft:H:O:p:i:u:l:C:S:n:s:", longopts,
+		c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S:n:s:o:", longopts,
 		                 &option);
 
 		if (c == -1 || c == EOF)
@@ -253,6 +255,12 @@
 			else
 				skip = atoi (optarg);
 			break;
+		case 'o':									/* Extra options for the ssh command */
+			asprintf (&comm, "%s -%c '%s'", comm, c, optarg);
+			break;
+		case 'q':									/* Tell the ssh command to be quiet */
+			asprintf (&comm, "%s -%c", comm, c);
+			break;
 		default:									/* help */
 			usage_va(_("Unknown argument - %s"), optarg);
 		}
@@ -344,6 +352,10 @@
   printf ("    %s\n", _("list of nagios service names, separated by ':' [optional]"));
   printf (" %s\n","-n, --name=NAME");
   printf ("    %s\n", _("short name of host in nagios configuration [optional]"));
+  printf (" %s\n","-o, --ssh-option=OPTION");
+  printf ("    %s\n", _("Call ssh with '-o OPTION' (may be used multiple times) [optional]"));
+  printf (" %s\n","-q, --quiet");
+  printf ("    %s\n", _("Tell ssh to suppress warning and diagnostic messages [optional]"));
 	printf (_(UT_WARN_CRIT));
 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
   printf (" %s\n", _("The most common mode of use is to refer to a local identity file with"));
@@ -371,6 +383,6 @@
 print_usage (void)
 {
 	printf (_("Usage:"));
-  printf(" %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname);
-  printf(" [-n name] [-s servicelist] [-O outputfile] [-p port]\n");
+  printf(" %s [-fq46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname);
+  printf(" [-n name] [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]\n");
 }





More information about the Commits mailing list