diff options
-rw-r--r-- | plugins/check_by_ssh.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 1d39985f..d1cbf936 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
@@ -166,6 +166,8 @@ process_arguments (int argc, char **argv) | |||
166 | {"proto2", no_argument, 0, '2'}, | 166 | {"proto2", no_argument, 0, '2'}, |
167 | {"use-ipv4", no_argument, 0, '4'}, | 167 | {"use-ipv4", no_argument, 0, '4'}, |
168 | {"use-ipv6", no_argument, 0, '6'}, | 168 | {"use-ipv6", no_argument, 0, '6'}, |
169 | {"ssh-option", required_argument, 0, 'o'}, | ||
170 | {"quiet", no_argument, 0, 'q'}, | ||
169 | {0, 0, 0, 0} | 171 | {0, 0, 0, 0} |
170 | }; | 172 | }; |
171 | 173 | ||
@@ -177,7 +179,7 @@ process_arguments (int argc, char **argv) | |||
177 | strcpy (argv[c], "-t"); | 179 | strcpy (argv[c], "-t"); |
178 | 180 | ||
179 | while (1) { | 181 | while (1) { |
180 | c = getopt_long (argc, argv, "Vvh1246ft:H:O:p:i:u:l:C:S:n:s:", longopts, | 182 | c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S:n:s:o:", longopts, |
181 | &option); | 183 | &option); |
182 | 184 | ||
183 | if (c == -1 || c == EOF) | 185 | if (c == -1 || c == EOF) |
@@ -253,6 +255,12 @@ process_arguments (int argc, char **argv) | |||
253 | else | 255 | else |
254 | skip = atoi (optarg); | 256 | skip = atoi (optarg); |
255 | break; | 257 | break; |
258 | case 'o': /* Extra options for the ssh command */ | ||
259 | asprintf (&comm, "%s -%c '%s'", comm, c, optarg); | ||
260 | break; | ||
261 | case 'q': /* Tell the ssh command to be quiet */ | ||
262 | asprintf (&comm, "%s -%c", comm, c); | ||
263 | break; | ||
256 | default: /* help */ | 264 | default: /* help */ |
257 | usage_va(_("Unknown argument - %s"), optarg); | 265 | usage_va(_("Unknown argument - %s"), optarg); |
258 | } | 266 | } |
@@ -344,6 +352,10 @@ print_help (void) | |||
344 | printf (" %s\n", _("list of nagios service names, separated by ':' [optional]")); | 352 | printf (" %s\n", _("list of nagios service names, separated by ':' [optional]")); |
345 | printf (" %s\n","-n, --name=NAME"); | 353 | printf (" %s\n","-n, --name=NAME"); |
346 | printf (" %s\n", _("short name of host in nagios configuration [optional]")); | 354 | printf (" %s\n", _("short name of host in nagios configuration [optional]")); |
355 | printf (" %s\n","-o, --ssh-option=OPTION"); | ||
356 | printf (" %s\n", _("Call ssh with '-o OPTION' (may be used multiple times) [optional]")); | ||
357 | printf (" %s\n","-q, --quiet"); | ||
358 | printf (" %s\n", _("Tell ssh to suppress warning and diagnostic messages [optional]")); | ||
347 | printf (_(UT_WARN_CRIT)); | 359 | printf (_(UT_WARN_CRIT)); |
348 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | 360 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
349 | printf (" %s\n", _("The most common mode of use is to refer to a local identity file with")); | 361 | printf (" %s\n", _("The most common mode of use is to refer to a local identity file with")); |
@@ -371,6 +383,6 @@ void | |||
371 | print_usage (void) | 383 | print_usage (void) |
372 | { | 384 | { |
373 | printf (_("Usage:")); | 385 | printf (_("Usage:")); |
374 | printf(" %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname); | 386 | printf(" %s [-fq46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname); |
375 | printf(" [-n name] [-s servicelist] [-O outputfile] [-p port]\n"); | 387 | printf(" [-n name] [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]\n"); |
376 | } | 388 | } |