summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--plugins/check_ntp_peer.c9
-rw-r--r--plugins/check_ntp_time.c9
3 files changed, 15 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 96c45917..cb68df66 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ This file documents the major additions and syntax changes between releases.
11 check_icmp now supports packet size modification 11 check_icmp now supports packet size modification
12 check_http -e now accepts a comma-delimited list of expected status codes 12 check_http -e now accepts a comma-delimited list of expected status codes
13 libtap now included with this distribution for easier testing. Run ./configure with --enable-libtap 13 libtap now included with this distribution for easier testing. Run ./configure with --enable-libtap
14 check_ntp_peer/check_ntp_time used to show port in --help but ignored the argument - now implemented.
14 15
151.4.12 27th May 2008 161.4.12 27th May 2008
16 Added ./check_nt -v INSTANCES to count number of instances (Alessandro Ren) 17 Added ./check_nt -v INSTANCES to count number of instances (Alessandro Ren)
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c
index 00c8e97d..72cec639 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
50static char *server_address=NULL; 50static char *server_address=NULL;
51static int port=123;
51static int verbose=0; 52static int verbose=0;
52static int quiet=0; 53static int quiet=0;
53static short do_offset=0; 54static 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;
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c
index ea24a0e7..655541e0 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
49static char *server_address=NULL; 49static char *server_address=NULL;
50static char *port="123";
50static int verbose=0; 51static int verbose=0;
51static int quiet=0; 52static int quiet=0;
52static char *owarn="60"; 53static 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;