diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-09-01 14:04:22 (GMT) |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-09-01 14:04:22 (GMT) |
commit | 122610e3730b8dd4afb41dfa48e65ba75f5586fe (patch) | |
tree | c42616425ba3936f2717a58c0d0c4495f826ed6b /plugins/check_ntp_time.c | |
parent | e9f976fbf3af9c5a923fd56f97e71bcf03d05716 (diff) | |
download | monitoring-plugins-122610e3730b8dd4afb41dfa48e65ba75f5586fe.tar.gz |
check_ntp_peer/check_ntp_time used to show port in --help but ignored the argument - now implemented.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2051 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_ntp_time.c')
-rw-r--r-- | plugins/check_ntp_time.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index ea24a0e..655541e 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c | |||
@@ -47,6 +47,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
47 | #include "utils.h" | 47 | #include "utils.h" |
48 | 48 | ||
49 | static char *server_address=NULL; | 49 | static char *server_address=NULL; |
50 | static char *port="123"; | ||
50 | static int verbose=0; | 51 | static int verbose=0; |
51 | static int quiet=0; | 52 | static int quiet=0; |
52 | static char *owarn="60"; | 53 | static char *owarn="60"; |
@@ -319,7 +320,7 @@ double offset_request(const char *host, int *status){ | |||
319 | hints.ai_socktype = SOCK_DGRAM; | 320 | hints.ai_socktype = SOCK_DGRAM; |
320 | 321 | ||
321 | /* fill in ai with the list of hosts resolved by the host name */ | 322 | /* fill in ai with the list of hosts resolved by the host name */ |
322 | ga_result = getaddrinfo(host, "123", &hints, &ai); | 323 | ga_result = getaddrinfo(host, port, &hints, &ai); |
323 | if(ga_result!=0){ | 324 | if(ga_result!=0){ |
324 | die(STATE_UNKNOWN, "error getting address for %s: %s\n", | 325 | die(STATE_UNKNOWN, "error getting address for %s: %s\n", |
325 | host, gai_strerror(ga_result)); | 326 | host, gai_strerror(ga_result)); |
@@ -456,6 +457,7 @@ int process_arguments(int argc, char **argv){ | |||
456 | {"critical", required_argument, 0, 'c'}, | 457 | {"critical", required_argument, 0, 'c'}, |
457 | {"timeout", required_argument, 0, 't'}, | 458 | {"timeout", required_argument, 0, 't'}, |
458 | {"hostname", required_argument, 0, 'H'}, | 459 | {"hostname", required_argument, 0, 'H'}, |
460 | {"port", required_argument, 0, 'p'}, | ||
459 | {0, 0, 0, 0} | 461 | {0, 0, 0, 0} |
460 | }; | 462 | }; |
461 | 463 | ||
@@ -464,7 +466,7 @@ int process_arguments(int argc, char **argv){ | |||
464 | usage ("\n"); | 466 | usage ("\n"); |
465 | 467 | ||
466 | while (1) { | 468 | while (1) { |
467 | c = getopt_long (argc, argv, "Vhv46qw:c:t:H:", longopts, &option); | 469 | c = getopt_long (argc, argv, "Vhv46qw:c:t:H:p:", longopts, &option); |
468 | if (c == -1 || c == EOF || c == 1) | 470 | if (c == -1 || c == EOF || c == 1) |
469 | break; | 471 | break; |
470 | 472 | ||
@@ -494,6 +496,9 @@ int process_arguments(int argc, char **argv){ | |||
494 | usage2(_("Invalid hostname/address"), optarg); | 496 | usage2(_("Invalid hostname/address"), optarg); |
495 | server_address = strdup(optarg); | 497 | server_address = strdup(optarg); |
496 | break; | 498 | break; |
499 | case 'p': | ||
500 | port = strdup(optarg); | ||
501 | break; | ||
497 | case 't': | 502 | case 't': |
498 | socket_timeout=atoi(optarg); | 503 | socket_timeout=atoi(optarg); |
499 | break; | 504 | break; |