diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-08-14 19:04:29 +0000 |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-08-14 19:04:29 +0000 |
commit | c62d37646b45b0a67bb4b3a0bf509ec898942075 (patch) | |
tree | c01b0b8ea44e843ec59a63569786b70ad001d508 /plugins/check_by_ssh.c | |
parent | 5940d7b65f8e3cfb1f800504ec0e9e6a3895bc0d (diff) | |
download | monitoring-plugins-c62d37646b45b0a67bb4b3a0bf509ec898942075.tar.gz |
ipv4/ipv6 switch added
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@76 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_by_ssh.c')
-rw-r--r-- | plugins/check_by_ssh.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index a81b333f..5aee5343 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
@@ -240,7 +240,7 @@ call_getopt (int argc, char **argv) | |||
240 | {"fork", no_argument, 0, 'f'}, | 240 | {"fork", no_argument, 0, 'f'}, |
241 | {"timeout", required_argument, 0, 't'}, | 241 | {"timeout", required_argument, 0, 't'}, |
242 | {"host", required_argument, 0, 'H'}, | 242 | {"host", required_argument, 0, 'H'}, |
243 | {"port", required_argument,0,'P'}, | 243 | {"port", required_argument,0,'p'}, |
244 | {"output", required_argument, 0, 'O'}, | 244 | {"output", required_argument, 0, 'O'}, |
245 | {"name", required_argument, 0, 'n'}, | 245 | {"name", required_argument, 0, 'n'}, |
246 | {"services", required_argument, 0, 's'}, | 246 | {"services", required_argument, 0, 's'}, |
@@ -248,6 +248,8 @@ call_getopt (int argc, char **argv) | |||
248 | {"user", required_argument, 0, 'u'}, | 248 | {"user", required_argument, 0, 'u'}, |
249 | {"logname", required_argument, 0, 'l'}, | 249 | {"logname", required_argument, 0, 'l'}, |
250 | {"command", required_argument, 0, 'C'}, | 250 | {"command", required_argument, 0, 'C'}, |
251 | {"use-ipv4", no_argument, 0, '4'}, | ||
252 | {"use-ipv6", no_argument, 0, '6'}, | ||
251 | {0, 0, 0, 0} | 253 | {0, 0, 0, 0} |
252 | }; | 254 | }; |
253 | #endif | 255 | #endif |
@@ -255,10 +257,10 @@ call_getopt (int argc, char **argv) | |||
255 | while (1) { | 257 | while (1) { |
256 | #ifdef HAVE_GETOPT_H | 258 | #ifdef HAVE_GETOPT_H |
257 | c = | 259 | c = |
258 | getopt_long (argc, argv, "+?Vvhft:H:O:P:p:i:u:l:C:n:s:", long_options, | 260 | getopt_long (argc, argv, "+?Vvhft46:H:O:p:i:u:l:C:n:s:", long_options, |
259 | &option_index); | 261 | &option_index); |
260 | #else | 262 | #else |
261 | c = getopt (argc, argv, "+?Vvhft:H:O:P:p:i:u:l:C:n:s:"); | 263 | c = getopt (argc, argv, "+?Vvhft46:H:O:p:i:u:l:C:n:s:"); |
262 | #endif | 264 | #endif |
263 | 265 | ||
264 | if (c == -1 || c == EOF) | 266 | if (c == -1 || c == EOF) |
@@ -304,7 +306,6 @@ call_getopt (int argc, char **argv) | |||
304 | usage2 ("invalid host name", optarg); | 306 | usage2 ("invalid host name", optarg); |
305 | hostname = optarg; | 307 | hostname = optarg; |
306 | break; | 308 | break; |
307 | case 'P': /* port number */ | ||
308 | case 'p': /* port number */ | 309 | case 'p': /* port number */ |
309 | if (!is_integer (optarg)) | 310 | if (!is_integer (optarg)) |
310 | usage2 ("port must be an integer", optarg); | 311 | usage2 ("port must be an integer", optarg); |
@@ -326,6 +327,12 @@ call_getopt (int argc, char **argv) | |||
326 | case 'i': /* identity */ | 327 | case 'i': /* identity */ |
327 | comm = ssprintf (comm, "%s -%c %s", comm, c, optarg); | 328 | comm = ssprintf (comm, "%s -%c %s", comm, c, optarg); |
328 | break; | 329 | break; |
330 | case '4': /* IPv4 */ | ||
331 | comm = ssprintf (comm, "%s -4", comm); | ||
332 | break; | ||
333 | case '6': /* IPv6 */ | ||
334 | comm = ssprintf (comm, "%s -4", comm); | ||
335 | break; | ||
329 | case 'C': /* Command for remote machine */ | 336 | case 'C': /* Command for remote machine */ |
330 | commands++; | 337 | commands++; |
331 | if (commands > 1) | 338 | if (commands > 1) |
@@ -372,7 +379,9 @@ print_help (char *cmd) | |||
372 | "-f tells ssh to fork rather than create a tty\n" | 379 | "-f tells ssh to fork rather than create a tty\n" |
373 | "-t, --timeout=INTEGER\n" | 380 | "-t, --timeout=INTEGER\n" |
374 | " specify timeout (default: %d seconds) [optional]\n" | 381 | " specify timeout (default: %d seconds) [optional]\n" |
375 | "-l, --logname=USERNAME\n" | 382 | "-p, --port=PORT\n" |
383 | " port to connect to on remote system [optional]\n" | ||
384 | "-l, --logname=USERNAME\n" | ||
376 | " SSH user name on remote host [optional]\n" | 385 | " SSH user name on remote host [optional]\n" |
377 | "-i, --identity=KEYFILE\n" | 386 | "-i, --identity=KEYFILE\n" |
378 | " identity of an authorized key [optional]\n" | 387 | " identity of an authorized key [optional]\n" |
@@ -382,6 +391,10 @@ print_help (char *cmd) | |||
382 | " list of nagios service names, separated by ':' [optional]\n" | 391 | " list of nagios service names, separated by ':' [optional]\n" |
383 | "-n, --name=NAME\n" | 392 | "-n, --name=NAME\n" |
384 | " short name of host in nagios configuration [optional]\n" | 393 | " short name of host in nagios configuration [optional]\n" |
394 | "-4, --use-ipv4\n" | ||
395 | " tell ssh to use IPv4\n" | ||
396 | "-6, --use-ipv6\n" | ||
397 | " tell ssh to use IPv6\n" | ||
385 | "\n" | 398 | "\n" |
386 | "The most common mode of use is to refer to a local identity file with\n" | 399 | "The most common mode of use is to refer to a local identity file with\n" |
387 | "the '-i' option. In this mode, the identity pair should have a null\n" | 400 | "the '-i' option. In this mode, the identity pair should have a null\n" |
@@ -405,8 +418,8 @@ print_usage (void) | |||
405 | { | 418 | { |
406 | printf | 419 | printf |
407 | ("Usage:\n" | 420 | ("Usage:\n" |
408 | "check_by_ssh [-f] [-t timeout] [-i identity] [-l user] -H <host> <command>\n" | 421 | "check_by_ssh [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>\n" |
409 | " [-n name] [-s servicelist] [-O outputfile] [-P port]\n" | 422 | " [-n name] [-s servicelist] [-O outputfile] [-p port]\n" |
410 | "check_by_ssh -V prints version info\n" | 423 | "check_by_ssh -V prints version info\n" |
411 | "check_by_ssh -h prints more detailed help\n"); | 424 | "check_by_ssh -h prints more detailed help\n"); |
412 | } | 425 | } |