summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp_time.c
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-12-04 12:38:56 (GMT)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-12-04 12:38:56 (GMT)
commit0d34c4da9decb76ea32b73c68497a6b83a791bd1 (patch)
treef6c6583fa76f6740afc733eb1cd379c0f3b5f1e3 /plugins/check_ntp_time.c
parentee6c34108031a217a5e92df50a1cb6544ff07cf9 (diff)
downloadmonitoring-plugins-0d34c4da9decb76ea32b73c68497a6b83a791bd1.tar.gz
Merge changes from branches/dermoth_ntp_rework (check_ntp_peer/check_ntp_time)
NEWS | 13 plugins/Makefile.am | 8 plugins/check_ntp_peer.c | 628 ++++++++++++++++------------------------------- plugins/check_ntp_time.c | 323 ++---------------------- plugins/t/check_ntp.t | 92 +++++- git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1846 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_ntp_time.c')
-rw-r--r--plugins/check_ntp_time.c323
1 files changed, 39 insertions, 284 deletions
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c
index 164d519..22e78fb 100644
--- a/plugins/check_ntp_time.c
+++ b/plugins/check_ntp_time.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2* 2*
3* Nagios check_ntp plugin 3* Nagios check_ntp_time plugin
4* 4*
5* License: GPL 5* License: GPL
6* Copyright (c) 2006 sean finney <seanius@seanius.net> 6* Copyright (c) 2006 sean finney <seanius@seanius.net>
@@ -10,10 +10,14 @@
10* 10*
11* Description: 11* Description:
12* 12*
13* This file contains the check_ntp plugin 13* This file contains the check_ntp_time plugin
14* 14*
15* This plugin to check ntp servers independant of any commandline 15* This plugin checks the clock offset between the local host and a
16* programs or external libraries. 16* remote NTP server. It is independent of any commandline programs or
17* external libraries.
18*
19* If you'd rather want to monitor an NTP server, please use
20* check_ntp_peer.
17* 21*
18* 22*
19* License Information: 23* License Information:
@@ -47,16 +51,12 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
47 51
48static char *server_address=NULL; 52static char *server_address=NULL;
49static int verbose=0; 53static int verbose=0;
50static short do_offset=0; 54static int quiet=0;
51static char *owarn="60"; 55static char *owarn="60";
52static char *ocrit="120"; 56static char *ocrit="120";
53static short do_jitter=0;
54static char *jwarn="5000";
55static char *jcrit="10000";
56 57
57int process_arguments (int, char **); 58int process_arguments (int, char **);
58thresholds *offset_thresholds = NULL; 59thresholds *offset_thresholds = NULL;
59thresholds *jitter_thresholds = NULL;
60void print_help (void); 60void print_help (void);
61void print_usage (void); 61void print_usage (void);
62 62
@@ -92,25 +92,6 @@ typedef struct {
92 uint8_t flags; /* byte with leapindicator,vers,mode. see macros */ 92 uint8_t flags; /* byte with leapindicator,vers,mode. see macros */
93} ntp_server_results; 93} ntp_server_results;
94 94
95/* this structure holds everything in an ntp control message as per rfc1305 */
96typedef struct {
97 uint8_t flags; /* byte with leapindicator,vers,mode. see macros */
98 uint8_t op; /* R,E,M bits and Opcode */
99 uint16_t seq; /* Packet sequence */
100 uint16_t status; /* Clock status */
101 uint16_t assoc; /* Association */
102 uint16_t offset; /* Similar to TCP sequence # */
103 uint16_t count; /* # bytes of data */
104 char data[MAX_CM_SIZE]; /* ASCII data of the request */
105 /* NB: not necessarily NULL terminated! */
106} ntp_control_message;
107
108/* this is an association/status-word pair found in control packet reponses */
109typedef struct {
110 uint16_t assoc;
111 uint16_t status;
112} ntp_assoc_status_pair;
113
114/* bits 1,2 are the leap indicator */ 95/* bits 1,2 are the leap indicator */
115#define LI_MASK 0xc0 96#define LI_MASK 0xc0
116#define LI(x) ((x&LI_MASK)>>6) 97#define LI(x) ((x&LI_MASK)>>6)
@@ -246,42 +227,6 @@ void print_ntp_message(const ntp_message *p){
246 printf("\ttxts = %-.16g\n", NTP64asDOUBLE(p->txts)); 227 printf("\ttxts = %-.16g\n", NTP64asDOUBLE(p->txts));
247} 228}
248 229
249void print_ntp_control_message(const ntp_control_message *p){
250 int i=0, numpeers=0;
251 const ntp_assoc_status_pair *peer=NULL;
252
253 printf("control packet contents:\n");
254 printf("\tflags: 0x%.2x , 0x%.2x\n", p->flags, p->op);
255 printf("\t li=%d (0x%.2x)\n", LI(p->flags), p->flags&LI_MASK);
256 printf("\t vn=%d (0x%.2x)\n", VN(p->flags), p->flags&VN_MASK);
257 printf("\t mode=%d (0x%.2x)\n", MODE(p->flags), p->flags&MODE_MASK);
258 printf("\t response=%d (0x%.2x)\n", (p->op&REM_RESP)>0, p->op&REM_RESP);
259 printf("\t more=%d (0x%.2x)\n", (p->op&REM_MORE)>0, p->op&REM_MORE);
260 printf("\t error=%d (0x%.2x)\n", (p->op&REM_ERROR)>0, p->op&REM_ERROR);
261 printf("\t op=%d (0x%.2x)\n", p->op&OP_MASK, p->op&OP_MASK);
262 printf("\tsequence: %d (0x%.2x)\n", ntohs(p->seq), ntohs(p->seq));
263 printf("\tstatus: %d (0x%.2x)\n", ntohs(p->status), ntohs(p->status));
264 printf("\tassoc: %d (0x%.2x)\n", ntohs(p->assoc), ntohs(p->assoc));
265 printf("\toffset: %d (0x%.2x)\n", ntohs(p->offset), ntohs(p->offset));
266 printf("\tcount: %d (0x%.2x)\n", ntohs(p->count), ntohs(p->count));
267 numpeers=ntohs(p->count)/(sizeof(ntp_assoc_status_pair));
268 if(p->op&REM_RESP && p->op&OP_READSTAT){
269 peer=(ntp_assoc_status_pair*)p->data;
270 for(i=0;i<numpeers;i++){
271 printf("\tpeer id %.2x status %.2x",
272 ntohs(peer[i].assoc), ntohs(peer[i].status));
273 if (PEER_SEL(peer[i].status) >= PEER_INCLUDED){
274 if(PEER_SEL(peer[i].status) >= PEER_SYNCSOURCE){
275 printf(" <-- current sync source");
276 } else {
277 printf(" <-- current sync candidate");
278 }
279 }
280 printf("\n");
281 }
282 }
283}
284
285void setup_request(ntp_message *p){ 230void setup_request(ntp_message *p){
286 struct timeval t; 231 struct timeval t;
287 232
@@ -411,13 +356,13 @@ double offset_request(const char *host, int *status){
411 ai_tmp = ai_tmp->ai_next; 356 ai_tmp = ai_tmp->ai_next;
412 } 357 }
413 358
414 /* now do AVG_NUM checks to each host. we stop before timeout/2 seconds 359 /* now do AVG_NUM checks to each host. We stop before timeout/2 seconds
415 * have passed in order to ensure post-processing and jitter time. */ 360 * have passed in order to ensure post-processing and jitter time. */
416 now_time=start_ts=time(NULL); 361 now_time=start_ts=time(NULL);
417 while(servers_completed<num_hosts && now_time-start_ts <= socket_timeout/2){ 362 while(servers_completed<num_hosts && now_time-start_ts <= socket_timeout/2){
418 /* loop through each server and find each one which hasn't 363 /* loop through each server and find each one which hasn't
419 * been touched in the past second or so and is still lacking 364 * been touched in the past second or so and is still lacking
420 * some responses. for each of these servers, send a new request, 365 * some responses. For each of these servers, send a new request,
421 * and update the "waiting" timestamp with the current time. */ 366 * and update the "waiting" timestamp with the current time. */
422 one_written=0; 367 one_written=0;
423 now_time=time(NULL); 368 now_time=time(NULL);
@@ -486,10 +431,7 @@ double offset_request(const char *host, int *status){
486 } 431 }
487 432
488 /* cleanup */ 433 /* cleanup */
489 /* FIXME: Not closing the socket to avoid re-use of the local port 434 for(j=0; j<num_hosts; j++){ close(socklist[j]); }
490 * which can cause old NTP packets to be read instead of NTP control
491 * pactets in jitter_request(). THERE MUST BE ANOTHER WAY...
492 * for(j=0; j<num_hosts; j++){ close(socklist[j]); } */
493 free(socklist); 435 free(socklist);
494 free(ufds); 436 free(ufds);
495 free(servers); 437 free(servers);
@@ -500,155 +442,6 @@ double offset_request(const char *host, int *status){
500 return avg_offset; 442 return avg_offset;
501} 443}
502 444
503void
504setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){
505 memset(p, 0, sizeof(ntp_control_message));
506 LI_SET(p->flags, LI_NOWARNING);
507 VN_SET(p->flags, VN_RESERVED);
508 MODE_SET(p->flags, MODE_CONTROLMSG);
509 OP_SET(p->op, opcode);
510 p->seq = htons(seq);
511 /* Remaining fields are zero for requests */
512}
513
514/* XXX handle responses with the error bit set */
515double jitter_request(const char *host, int *status){
516 int conn=-1, i, npeers=0, num_candidates=0, syncsource_found=0;
517 int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0;
518 int peers_size=0, peer_offset=0;
519 ntp_assoc_status_pair *peers=NULL;
520 ntp_control_message req;
521 const char *getvar = "jitter";
522 double rval = 0.0, jitter = -1.0;
523 char *startofvalue=NULL, *nptr=NULL;
524 void *tmp;
525
526 /* Long-winded explanation:
527 * Getting the jitter requires a number of steps:
528 * 1) Send a READSTAT request.
529 * 2) Interpret the READSTAT reply
530 * a) The data section contains a list of peer identifiers (16 bits)
531 * and associated status words (16 bits)
532 * b) We want the value of 0x06 in the SEL (peer selection) value,
533 * which means "current synchronizatin source". If that's missing,
534 * we take anything better than 0x04 (see the rfc for details) but
535 * set a minimum of warning.
536 * 3) Send a READVAR request for information on each peer identified
537 * in 2b greater than the minimum selection value.
538 * 4) Extract the jitter value from the data[] (it's ASCII)
539 */
540 my_udp_connect(server_address, 123, &conn);
541
542 /* keep sending requests until the server stops setting the
543 * REM_MORE bit, though usually this is only 1 packet. */
544 do{
545 setup_control_request(&req, OP_READSTAT, 1);
546 DBG(printf("sending READSTAT request"));
547 write(conn, &req, SIZEOF_NTPCM(req));
548 DBG(print_ntp_control_message(&req));
549 /* Attempt to read the largest size packet possible */
550 req.count=htons(MAX_CM_SIZE);
551 DBG(printf("recieving READSTAT response"))
552 read(conn, &req, SIZEOF_NTPCM(req));
553 DBG(print_ntp_control_message(&req));
554 /* Each peer identifier is 4 bytes in the data section, which
555 * we represent as a ntp_assoc_status_pair datatype.
556 */
557 peers_size+=ntohs(req.count);
558 if((tmp=realloc(peers, peers_size)) == NULL)
559 free(peers), die(STATE_UNKNOWN, "can not (re)allocate 'peers' buffer\n");
560 peers=tmp;
561 memcpy((void*)((ptrdiff_t)peers+peer_offset), (void*)req.data, ntohs(req.count));
562 npeers=peers_size/sizeof(ntp_assoc_status_pair);
563 peer_offset+=ntohs(req.count);
564 } while(req.op&REM_MORE);
565
566 /* first, let's find out if we have a sync source, or if there are
567 * at least some candidates. in the case of the latter we'll issue
568 * a warning but go ahead with the check on them. */
569 for (i = 0; i < npeers; i++){
570 if (PEER_SEL(peers[i].status) >= PEER_INCLUDED){
571 num_candidates++;
572 if(PEER_SEL(peers[i].status) >= PEER_SYNCSOURCE){
573 syncsource_found=1;
574 min_peer_sel=PEER_SYNCSOURCE;
575 }
576 }
577 }
578 if(verbose) printf("%d candiate peers available\n", num_candidates);
579 if(verbose && syncsource_found) printf("synchronization source found\n");
580 if(! syncsource_found){
581 *status = STATE_UNKNOWN;
582 if(verbose) printf("warning: no synchronization source found\n");
583 }
584
585
586 for (run=0; run<AVG_NUM; run++){
587 if(verbose) printf("jitter run %d of %d\n", run+1, AVG_NUM);
588 for (i = 0; i < npeers; i++){
589 /* Only query this server if it is the current sync source */
590 if (PEER_SEL(peers[i].status) >= min_peer_sel){
591 num_selected++;
592 setup_control_request(&req, OP_READVAR, 2);
593 req.assoc = peers[i].assoc;
594 /* By spec, putting the variable name "jitter" in the request
595 * should cause the server to provide _only_ the jitter value.
596 * thus reducing net traffic, guaranteeing us only a single
597 * datagram in reply, and making intepretation much simpler
598 */
599 /* Older servers doesn't know what jitter is, so if we get an
600 * error on the first pass we redo it with "dispersion" */
601 strncpy(req.data, getvar, MAX_CM_SIZE-1);
602 req.count = htons(strlen(getvar));
603 DBG(printf("sending READVAR request...\n"));
604 write(conn, &req, SIZEOF_NTPCM(req));
605 DBG(print_ntp_control_message(&req));
606
607 req.count = htons(MAX_CM_SIZE);
608 DBG(printf("recieving READVAR response...\n"));
609 read(conn, &req, SIZEOF_NTPCM(req));
610 DBG(print_ntp_control_message(&req));
611
612 if(req.op&REM_ERROR && strstr(getvar, "jitter")) {
613 if(verbose) printf("The 'jitter' command failed (old ntp server?)\nRestarting with 'dispersion'...\n");
614 getvar = "dispersion";
615 num_selected--;
616 i--;
617 continue;
618 }
619
620 /* get to the float value */
621 if(verbose) {
622 printf("parsing jitter from peer %.2x: ", ntohs(peers[i].assoc));
623 }
624 startofvalue = strchr(req.data, '=');
625 if(startofvalue != NULL) {
626 startofvalue++;
627 jitter = strtod(startofvalue, &nptr);
628 }
629 if(startofvalue == NULL || startofvalue==nptr){
630 printf("warning: unable to read server jitter response.\n");
631 *status = STATE_UNKNOWN;
632 } else {
633 if(verbose) printf("%g\n", jitter);
634 num_valid++;
635 rval += jitter;
636 }
637 }
638 }
639 if(verbose){
640 printf("jitter parsed from %d/%d peers\n", num_valid, num_selected);
641 }
642 }
643
644 rval = num_valid ? rval / num_valid : -1.0;
645
646 close(conn);
647 if(peers!=NULL) free(peers);
648 /* If we return -1.0, it means no synchronization source was found */
649 return rval;
650}
651
652int process_arguments(int argc, char **argv){ 445int process_arguments(int argc, char **argv){
653 int c; 446 int c;
654 int option=0; 447 int option=0;
@@ -658,10 +451,9 @@ int process_arguments(int argc, char **argv){
658 {"verbose", no_argument, 0, 'v'}, 451 {"verbose", no_argument, 0, 'v'},
659 {"use-ipv4", no_argument, 0, '4'}, 452 {"use-ipv4", no_argument, 0, '4'},
660 {"use-ipv6", no_argument, 0, '6'}, 453 {"use-ipv6", no_argument, 0, '6'},
454 {"quiet", no_argument, 0, 'q'},
661 {"warning", required_argument, 0, 'w'}, 455 {"warning", required_argument, 0, 'w'},
662 {"critical", required_argument, 0, 'c'}, 456 {"critical", required_argument, 0, 'c'},
663 {"jwarn", required_argument, 0, 'j'},
664 {"jcrit", required_argument, 0, 'k'},
665 {"timeout", required_argument, 0, 't'}, 457 {"timeout", required_argument, 0, 't'},
666 {"hostname", required_argument, 0, 'H'}, 458 {"hostname", required_argument, 0, 'H'},
667 {0, 0, 0, 0} 459 {0, 0, 0, 0}
@@ -672,7 +464,7 @@ int process_arguments(int argc, char **argv){
672 usage ("\n"); 464 usage ("\n");
673 465
674 while (1) { 466 while (1) {
675 c = getopt_long (argc, argv, "Vhv46w:c:j:k:t:H:", longopts, &option); 467 c = getopt_long (argc, argv, "Vhv46qw:c:t:H:", longopts, &option);
676 if (c == -1 || c == EOF || c == 1) 468 if (c == -1 || c == EOF || c == 1)
677 break; 469 break;
678 470
@@ -688,22 +480,15 @@ int process_arguments(int argc, char **argv){
688 case 'v': 480 case 'v':
689 verbose++; 481 verbose++;
690 break; 482 break;
483 case 'q':
484 quiet = 1;
485 break;
691 case 'w': 486 case 'w':
692 do_offset=1;
693 owarn = optarg; 487 owarn = optarg;
694 break; 488 break;
695 case 'c': 489 case 'c':
696 do_offset=1;
697 ocrit = optarg; 490 ocrit = optarg;
698 break; 491 break;
699 case 'j':
700 do_jitter=1;
701 jwarn = optarg;
702 break;
703 case 'k':
704 do_jitter=1;
705 jcrit = optarg;
706 break;
707 case 'H': 492 case 'H':
708 if(is_host(optarg) == FALSE) 493 if(is_host(optarg) == FALSE)
709 usage2(_("Invalid hostname/address"), optarg); 494 usage2(_("Invalid hostname/address"), optarg);
@@ -744,26 +529,17 @@ char *perfd_offset (double offset)
744 FALSE, 0, FALSE, 0); 529 FALSE, 0, FALSE, 0);
745} 530}
746 531
747char *perfd_jitter (double jitter)
748{
749 return fperfdata ("jitter", jitter, "s",
750 do_jitter, jitter_thresholds->warning->end,
751 do_jitter, jitter_thresholds->critical->end,
752 TRUE, 0, FALSE, 0);
753}
754
755int main(int argc, char *argv[]){ 532int main(int argc, char *argv[]){
756 int result, offset_result, jitter_result; 533 int result, offset_result;
757 double offset=0, jitter=0; 534 double offset=0;
758 char *result_line, *perfdata_line; 535 char *result_line, *perfdata_line;
759 536
760 result = offset_result = jitter_result = STATE_OK; 537 result = offset_result = STATE_OK;
761 538
762 if (process_arguments (argc, argv) == ERROR) 539 if (process_arguments (argc, argv) == ERROR)
763 usage4 (_("Could not parse arguments")); 540 usage4 (_("Could not parse arguments"));
764 541
765 set_thresholds(&offset_thresholds, owarn, ocrit); 542 set_thresholds(&offset_thresholds, owarn, ocrit);
766 set_thresholds(&jitter_thresholds, jwarn, jcrit);
767 543
768 /* initialize alarm signal handling */ 544 /* initialize alarm signal handling */
769 signal (SIGALRM, socket_timeout_alarm_handler); 545 signal (SIGALRM, socket_timeout_alarm_handler);
@@ -772,29 +548,12 @@ int main(int argc, char *argv[]){
772 alarm (socket_timeout); 548 alarm (socket_timeout);
773 549
774 offset = offset_request(server_address, &offset_result); 550 offset = offset_request(server_address, &offset_result);
775 /* check_ntp used to always return CRITICAL if offset_result == STATE_UNKNOWN. 551 if (offset_result == STATE_UNKNOWN) {
776 * Now we'll only do that is the offset thresholds were set */ 552 result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL);
777 if (do_offset && offset_result == STATE_UNKNOWN) {
778 result = STATE_CRITICAL;
779 } else { 553 } else {
780 result = get_status(fabs(offset), offset_thresholds); 554 result = get_status(fabs(offset), offset_thresholds);
781 } 555 }
782 556
783 /* If not told to check the jitter, we don't even send packets.
784 * jitter is checked using NTP control packets, which not all
785 * servers recognize. Trying to check the jitter on OpenNTPD
786 * (for example) will result in an error
787 */
788 if(do_jitter){
789 jitter=jitter_request(server_address, &jitter_result);
790 result = max_state_alt(result, get_status(jitter, jitter_thresholds));
791 /* -1 indicates that we couldn't calculate the jitter
792 * Only overrides STATE_OK from the offset */
793 if(jitter == -1.0 && result == STATE_OK)
794 result = STATE_UNKNOWN;
795 }
796 result = max_state_alt(result, jitter_result);
797
798 switch (result) { 557 switch (result) {
799 case STATE_CRITICAL : 558 case STATE_CRITICAL :
800 asprintf(&result_line, "NTP CRITICAL:"); 559 asprintf(&result_line, "NTP CRITICAL:");
@@ -816,55 +575,49 @@ int main(int argc, char *argv[]){
816 asprintf(&result_line, "%s Offset %.10g secs", result_line, offset); 575 asprintf(&result_line, "%s Offset %.10g secs", result_line, offset);
817 asprintf(&perfdata_line, "%s", perfd_offset(offset)); 576 asprintf(&perfdata_line, "%s", perfd_offset(offset));
818 } 577 }
819 if (do_jitter) {
820 asprintf(&result_line, "%s, jitter=%f", result_line, jitter);
821 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter));
822 }
823 printf("%s|%s\n", result_line, perfdata_line); 578 printf("%s|%s\n", result_line, perfdata_line);
824 579
825 if(server_address!=NULL) free(server_address); 580 if(server_address!=NULL) free(server_address);
826 return result; 581 return result;
827} 582}
828 583
829
830
831void print_help(void){ 584void print_help(void){
832 print_revision(progname, revision); 585 print_revision(progname, revision);
833 586
834 printf ("Copyright (c) 2006 Sean Finney\n"); 587 printf ("Copyright (c) 2006 Sean Finney\n");
835 printf (COPYRIGHT, copyright, email); 588 printf (COPYRIGHT, copyright, email);
836
837 printf ("%s\n", _("This plugin checks the selected ntp server"));
838 589
839 printf ("\n\n"); 590 printf ("%s\n", _("This plugin checks the clock offset with the ntp server"));
840 591
592 printf ("\n\n");
593
841 print_usage(); 594 print_usage();
842 printf (_(UT_HELP_VRSN)); 595 printf (_(UT_HELP_VRSN));
843 printf (_(UT_HOST_PORT), 'p', "123"); 596 printf (_(UT_HOST_PORT), 'p', "123");
597 printf (" %s\n", "-q, --quiet");
598 printf (" %s\n", _("Returns UNKNOWN instead of CRITICAL if offset cannot be found"));
844 printf (" %s\n", "-w, --warning=THRESHOLD"); 599 printf (" %s\n", "-w, --warning=THRESHOLD");
845 printf (" %s\n", _("Offset to result in warning status (seconds)")); 600 printf (" %s\n", _("Offset to result in warning status (seconds)"));
846 printf (" %s\n", "-c, --critical=THRESHOLD"); 601 printf (" %s\n", "-c, --critical=THRESHOLD");
847 printf (" %s\n", _("Offset to result in critical status (seconds)")); 602 printf (" %s\n", _("Offset to result in critical status (seconds)"));
848 printf (" %s\n", "-j, --warning=THRESHOLD");
849 printf (" %s\n", _("Warning threshold for jitter"));
850 printf (" %s\n", "-k, --critical=THRESHOLD");
851 printf (" %s\n", _("Critical threshold for jitter"));
852 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); 603 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
853 printf (_(UT_VERBOSE)); 604 printf (_(UT_VERBOSE));
854 605
855 printf("\n"); 606 printf("\n");
856 printf("%s\n", _("Notes:")); 607 printf("%s\n", _("Notes:"));
608 printf(" %s\n", _("This plugin checks the clock offset between the local host and a"));
609 printf(" %s\n", _("remote NTP server. It is independent of any commandline programs or"));
610 printf(" %s\n\n", _("external libraries."));
611 printf(" %s\n", _("If you'd rather want to monitor an NTP server, please use"));
612 printf(" %s\n\n", _("check_ntp_peer."));
613
857 printf(" %s\n", _("See:")); 614 printf(" %s\n", _("See:"));
858 printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT")); 615 printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT"));
859 printf(" %s\n", _("for THRESHOLD format and examples.")); 616 printf(" %s\n", _("for THRESHOLD format and examples."));
860 617
861 printf("\n"); 618 printf("\n");
862 printf("%s\n", _("Examples:")); 619 printf("%s\n", _("Examples:"));
863 printf(" %s\n", _("Normal offset check:")); 620 printf(" %s\n", ("./check_ntp_time -H ntpserv -w 0.5 -c 1"));
864 printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1"));
865 printf(" %s\n", _("Check jitter too, avoiding critical notifications if jitter isn't available"));
866 printf(" %s\n", _("(See Notes above for more details on thresholds formats):"));
867 printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1 -j -1:100 -k -1:200"));
868 621
869 printf (_(UT_SUPPORT)); 622 printf (_(UT_SUPPORT));
870} 623}
@@ -872,6 +625,8 @@ void print_help(void){
872void 625void
873print_usage(void) 626print_usage(void)
874{ 627{
875 printf (_("Usage:")); 628 printf (_("Usage:"));
876 printf(" %s -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n", progname); 629 printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname);
630 printf(" [-j <warn>] [-k <crit>] [-v verbose]\n");
877} 631}
632