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_peer.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_peer.c')
-rw-r--r-- | plugins/check_ntp_peer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index 00c8e97..72cec63 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c | |||
@@ -48,6 +48,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
48 | #include "utils.h" | 48 | #include "utils.h" |
49 | 49 | ||
50 | static char *server_address=NULL; | 50 | static char *server_address=NULL; |
51 | static int port=123; | ||
51 | static int verbose=0; | 52 | static int verbose=0; |
52 | static int quiet=0; | 53 | static int quiet=0; |
53 | static short do_offset=0; | 54 | static short do_offset=0; |
@@ -283,7 +284,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji | |||
283 | * 4) Extract the offset, jitter and stratum value from the data[] | 284 | * 4) Extract the offset, jitter and stratum value from the data[] |
284 | * (it's ASCII) | 285 | * (it's ASCII) |
285 | */ | 286 | */ |
286 | my_udp_connect(server_address, 123, &conn); | 287 | my_udp_connect(server_address, port, &conn); |
287 | 288 | ||
288 | /* keep sending requests until the server stops setting the | 289 | /* keep sending requests until the server stops setting the |
289 | * REM_MORE bit, though usually this is only 1 packet. */ | 290 | * REM_MORE bit, though usually this is only 1 packet. */ |
@@ -469,6 +470,7 @@ int process_arguments(int argc, char **argv){ | |||
469 | {"jcrit", required_argument, 0, 'k'}, | 470 | {"jcrit", required_argument, 0, 'k'}, |
470 | {"timeout", required_argument, 0, 't'}, | 471 | {"timeout", required_argument, 0, 't'}, |
471 | {"hostname", required_argument, 0, 'H'}, | 472 | {"hostname", required_argument, 0, 'H'}, |
473 | {"port", required_argument, 0, 'p'}, | ||
472 | {0, 0, 0, 0} | 474 | {0, 0, 0, 0} |
473 | }; | 475 | }; |
474 | 476 | ||
@@ -477,7 +479,7 @@ int process_arguments(int argc, char **argv){ | |||
477 | usage ("\n"); | 479 | usage ("\n"); |
478 | 480 | ||
479 | while (1) { | 481 | while (1) { |
480 | c = getopt_long (argc, argv, "Vhv46qw:c:W:C:j:k:t:H:", longopts, &option); | 482 | c = getopt_long (argc, argv, "Vhv46qw:c:W:C:j:k:t:H:p:", longopts, &option); |
481 | if (c == -1 || c == EOF || c == 1) | 483 | if (c == -1 || c == EOF || c == 1) |
482 | break; | 484 | break; |
483 | 485 | ||
@@ -525,6 +527,9 @@ int process_arguments(int argc, char **argv){ | |||
525 | usage2(_("Invalid hostname/address"), optarg); | 527 | usage2(_("Invalid hostname/address"), optarg); |
526 | server_address = strdup(optarg); | 528 | server_address = strdup(optarg); |
527 | break; | 529 | break; |
530 | case 'p': | ||
531 | port=atoi(optarg); | ||
532 | break; | ||
528 | case 't': | 533 | case 't': |
529 | socket_timeout=atoi(optarg); | 534 | socket_timeout=atoi(optarg); |
530 | break; | 535 | break; |