60e2b5a0eab03523363f8d5c758519fa3b19c9cc
1 /******************************************************************************
2 *
3 * Nagios check_ntp_time plugin
4 *
5 * License: GPL
6 * Copyright (c) 2006 sean finney <seanius@seanius.net>
7 * Copyright (c) 2007 nagios-plugins team
8 *
9 * Last Modified: $Date$
10 *
11 * Description:
12 *
13 * This file contains the check_ntp_time plugin
14 *
15 * This plugin checks the clock offset between the local host and a
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.
21 *
22 *
23 * License Information:
24 *
25 * This program is free software; you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License as published by
27 * the Free Software Foundation; either version 2 of the License, or
28 * (at your option) any later version.
29 *
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
34 *
35 * You should have received a copy of the GNU General Public License
36 * along with this program; if not, write to the Free Software
37 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
39 $Id$
41 *****************************************************************************/
43 const char *progname = "check_ntp_time";
44 const char *revision = "$Revision$";
45 const char *copyright = "2007";
46 const char *email = "nagiosplug-devel@lists.sourceforge.net";
48 #include "common.h"
49 #include "netutils.h"
50 #include "utils.h"
52 static char *server_address=NULL;
53 static int verbose=0;
54 static int quiet=0;
55 static char *owarn="60";
56 static char *ocrit="120";
58 int process_arguments (int, char **);
59 thresholds *offset_thresholds = NULL;
60 void print_help (void);
61 void print_usage (void);
63 /* number of times to perform each request to get a good average. */
64 #define AVG_NUM 4
66 /* max size of control message data */
67 #define MAX_CM_SIZE 468
69 /* this structure holds everything in an ntp request/response as per rfc1305 */
70 typedef struct {
71 uint8_t flags; /* byte with leapindicator,vers,mode. see macros */
72 uint8_t stratum; /* clock stratum */
73 int8_t poll; /* polling interval */
74 int8_t precision; /* precision of the local clock */
75 int32_t rtdelay; /* total rt delay, as a fixed point num. see macros */
76 uint32_t rtdisp; /* like above, but for max err to primary src */
77 uint32_t refid; /* ref clock identifier */
78 uint64_t refts; /* reference timestamp. local time local clock */
79 uint64_t origts; /* time at which request departed client */
80 uint64_t rxts; /* time at which request arrived at server */
81 uint64_t txts; /* time at which request departed server */
82 } ntp_message;
84 /* this structure holds data about results from querying offset from a peer */
85 typedef struct {
86 time_t waiting; /* ts set when we started waiting for a response */
87 int num_responses; /* number of successfully recieved responses */
88 uint8_t stratum; /* copied verbatim from the ntp_message */
89 double rtdelay; /* converted from the ntp_message */
90 double rtdisp; /* converted from the ntp_message */
91 double offset[AVG_NUM]; /* offsets from each response */
92 uint8_t flags; /* byte with leapindicator,vers,mode. see macros */
93 } ntp_server_results;
95 /* bits 1,2 are the leap indicator */
96 #define LI_MASK 0xc0
97 #define LI(x) ((x&LI_MASK)>>6)
98 #define LI_SET(x,y) do{ x |= ((y<<6)&LI_MASK); }while(0)
99 /* and these are the values of the leap indicator */
100 #define LI_NOWARNING 0x00
101 #define LI_EXTRASEC 0x01
102 #define LI_MISSINGSEC 0x02
103 #define LI_ALARM 0x03
104 /* bits 3,4,5 are the ntp version */
105 #define VN_MASK 0x38
106 #define VN(x) ((x&VN_MASK)>>3)
107 #define VN_SET(x,y) do{ x |= ((y<<3)&VN_MASK); }while(0)
108 #define VN_RESERVED 0x02
109 /* bits 6,7,8 are the ntp mode */
110 #define MODE_MASK 0x07
111 #define MODE(x) (x&MODE_MASK)
112 #define MODE_SET(x,y) do{ x |= (y&MODE_MASK); }while(0)
113 /* here are some values */
114 #define MODE_CLIENT 0x03
115 #define MODE_CONTROLMSG 0x06
116 /* In control message, bits 8-10 are R,E,M bits */
117 #define REM_MASK 0xe0
118 #define REM_RESP 0x80
119 #define REM_ERROR 0x40
120 #define REM_MORE 0x20
121 /* In control message, bits 11 - 15 are opcode */
122 #define OP_MASK 0x1f
123 #define OP_SET(x,y) do{ x |= (y&OP_MASK); }while(0)
124 #define OP_READSTAT 0x01
125 #define OP_READVAR 0x02
126 /* In peer status bytes, bits 6,7,8 determine clock selection status */
127 #define PEER_SEL(x) ((ntohs(x)>>8)&0x07)
128 #define PEER_INCLUDED 0x04
129 #define PEER_SYNCSOURCE 0x06
131 /**
132 ** a note about the 32-bit "fixed point" numbers:
133 **
134 they are divided into halves, each being a 16-bit int in network byte order:
135 - the first 16 bits are an int on the left side of a decimal point.
136 - the second 16 bits represent a fraction n/(2^16)
137 likewise for the 64-bit "fixed point" numbers with everything doubled :)
138 **/
140 /* macros to access the left/right 16 bits of a 32-bit ntp "fixed point"
141 number. note that these can be used as lvalues too */
142 #define L16(x) (((uint16_t*)&x)[0])
143 #define R16(x) (((uint16_t*)&x)[1])
144 /* macros to access the left/right 32 bits of a 64-bit ntp "fixed point"
145 number. these too can be used as lvalues */
146 #define L32(x) (((uint32_t*)&x)[0])
147 #define R32(x) (((uint32_t*)&x)[1])
149 /* ntp wants seconds since 1/1/00, epoch is 1/1/70. this is the difference */
150 #define EPOCHDIFF 0x83aa7e80UL
152 /* extract a 32-bit ntp fixed point number into a double */
153 #define NTP32asDOUBLE(x) (ntohs(L16(x)) + (double)ntohs(R16(x))/65536.0)
155 /* likewise for a 64-bit ntp fp number */
156 #define NTP64asDOUBLE(n) (double)(((uint64_t)n)?\
157 (ntohl(L32(n))-EPOCHDIFF) + \
158 (.00000001*(0.5+(double)(ntohl(R32(n))/42.94967296))):\
159 0)
161 /* convert a struct timeval to a double */
162 #define TVasDOUBLE(x) (double)(x.tv_sec+(0.000001*x.tv_usec))
164 /* convert an ntp 64-bit fp number to a struct timeval */
165 #define NTP64toTV(n,t) \
166 do{ if(!n) t.tv_sec = t.tv_usec = 0; \
167 else { \
168 t.tv_sec=ntohl(L32(n))-EPOCHDIFF; \
169 t.tv_usec=(int)(0.5+(double)(ntohl(R32(n))/4294.967296)); \
170 } \
171 }while(0)
173 /* convert a struct timeval to an ntp 64-bit fp number */
174 #define TVtoNTP64(t,n) \
175 do{ if(!t.tv_usec && !t.tv_sec) n=0x0UL; \
176 else { \
177 L32(n)=htonl(t.tv_sec + EPOCHDIFF); \
178 R32(n)=htonl((uint64_t)((4294.967296*t.tv_usec)+.5)); \
179 } \
180 } while(0)
182 /* NTP control message header is 12 bytes, plus any data in the data
183 * field, plus null padding to the nearest 32-bit boundary per rfc.
184 */
185 #define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((m.count)?4-(ntohs(m.count)%4):0))
187 /* finally, a little helper or two for debugging: */
188 #define DBG(x) do{if(verbose>1){ x; }}while(0);
189 #define PRINTSOCKADDR(x) \
190 do{ \
191 printf("%u.%u.%u.%u", (x>>24)&0xff, (x>>16)&0xff, (x>>8)&0xff, x&0xff);\
192 }while(0);
194 /* calculate the offset of the local clock */
195 static inline double calc_offset(const ntp_message *m, const struct timeval *t){
196 double client_tx, peer_rx, peer_tx, client_rx;
197 client_tx = NTP64asDOUBLE(m->origts);
198 peer_rx = NTP64asDOUBLE(m->rxts);
199 peer_tx = NTP64asDOUBLE(m->txts);
200 client_rx=TVasDOUBLE((*t));
201 return (.5*((peer_tx-client_rx)+(peer_rx-client_tx)));
202 }
204 /* print out a ntp packet in human readable/debuggable format */
205 void print_ntp_message(const ntp_message *p){
206 struct timeval ref, orig, rx, tx;
208 NTP64toTV(p->refts,ref);
209 NTP64toTV(p->origts,orig);
210 NTP64toTV(p->rxts,rx);
211 NTP64toTV(p->txts,tx);
213 printf("packet contents:\n");
214 printf("\tflags: 0x%.2x\n", p->flags);
215 printf("\t li=%d (0x%.2x)\n", LI(p->flags), p->flags&LI_MASK);
216 printf("\t vn=%d (0x%.2x)\n", VN(p->flags), p->flags&VN_MASK);
217 printf("\t mode=%d (0x%.2x)\n", MODE(p->flags), p->flags&MODE_MASK);
218 printf("\tstratum = %d\n", p->stratum);
219 printf("\tpoll = %g\n", pow(2, p->poll));
220 printf("\tprecision = %g\n", pow(2, p->precision));
221 printf("\trtdelay = %-.16g\n", NTP32asDOUBLE(p->rtdelay));
222 printf("\trtdisp = %-.16g\n", NTP32asDOUBLE(p->rtdisp));
223 printf("\trefid = %x\n", p->refid);
224 printf("\trefts = %-.16g\n", NTP64asDOUBLE(p->refts));
225 printf("\torigts = %-.16g\n", NTP64asDOUBLE(p->origts));
226 printf("\trxts = %-.16g\n", NTP64asDOUBLE(p->rxts));
227 printf("\ttxts = %-.16g\n", NTP64asDOUBLE(p->txts));
228 }
230 void setup_request(ntp_message *p){
231 struct timeval t;
233 memset(p, 0, sizeof(ntp_message));
234 LI_SET(p->flags, LI_ALARM);
235 VN_SET(p->flags, 4);
236 MODE_SET(p->flags, MODE_CLIENT);
237 p->poll=4;
238 p->precision=(int8_t)0xfa;
239 L16(p->rtdelay)=htons(1);
240 L16(p->rtdisp)=htons(1);
242 gettimeofday(&t, NULL);
243 TVtoNTP64(t,p->txts);
244 }
246 /* select the "best" server from a list of servers, and return its index.
247 * this is done by filtering servers based on stratum, dispersion, and
248 * finally round-trip delay. */
249 int best_offset_server(const ntp_server_results *slist, int nservers){
250 int i=0, j=0, cserver=0, candidates[5], csize=0;
252 /* for each server */
253 for(cserver=0; cserver<nservers; cserver++){
254 /* sort out servers with error flags */
255 if ( LI(slist[cserver].flags) != LI_NOWARNING ){
256 if (verbose) printf("discarding peer id %d: flags=%d\n", cserver, LI(slist[cserver].flags));
257 break;
258 }
260 /* compare it to each of the servers already in the candidate list */
261 for(i=0; i<csize; i++){
262 /* does it have an equal or better stratum? */
263 if(slist[cserver].stratum <= slist[i].stratum){
264 /* does it have an equal or better dispersion? */
265 if(slist[cserver].rtdisp <= slist[i].rtdisp){
266 /* does it have a better rtdelay? */
267 if(slist[cserver].rtdelay < slist[i].rtdelay){
268 break;
269 }
270 }
271 }
272 }
274 /* if we haven't reached the current list's end, move everyone
275 * over one to the right, and insert the new candidate */
276 if(i<csize){
277 for(j=5; j>i; j--){
278 candidates[j]=candidates[j-1];
279 }
280 }
281 /* regardless, if they should be on the list... */
282 if(i<5) {
283 candidates[i]=cserver;
284 if(csize<5) csize++;
285 /* otherwise discard the server */
286 } else {
287 DBG(printf("discarding peer id %d\n", cserver));
288 }
289 }
291 if(csize>0) {
292 DBG(printf("best server selected: peer %d\n", candidates[0]));
293 return candidates[0];
294 } else {
295 DBG(printf("no peers meeting synchronization criteria :(\n"));
296 return -1;
297 }
298 }
300 /* do everything we need to get the total average offset
301 * - we use a certain amount of parallelization with poll() to ensure
302 * we don't waste time sitting around waiting for single packets.
303 * - we also "manually" handle resolving host names and connecting, because
304 * we have to do it in a way that our lazy macros don't handle currently :( */
305 double offset_request(const char *host, int *status){
306 int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0;
307 int servers_completed=0, one_written=0, one_read=0, servers_readable=0, best_index=-1;
308 time_t now_time=0, start_ts=0;
309 ntp_message *req=NULL;
310 double avg_offset=0.;
311 struct timeval recv_time;
312 struct addrinfo *ai=NULL, *ai_tmp=NULL, hints;
313 struct pollfd *ufds=NULL;
314 ntp_server_results *servers=NULL;
316 /* setup hints to only return results from getaddrinfo that we'd like */
317 memset(&hints, 0, sizeof(struct addrinfo));
318 hints.ai_family = address_family;
319 hints.ai_protocol = IPPROTO_UDP;
320 hints.ai_socktype = SOCK_DGRAM;
322 /* fill in ai with the list of hosts resolved by the host name */
323 ga_result = getaddrinfo(host, "123", &hints, &ai);
324 if(ga_result!=0){
325 die(STATE_UNKNOWN, "error getting address for %s: %s\n",
326 host, gai_strerror(ga_result));
327 }
329 /* count the number of returned hosts, and allocate stuff accordingly */
330 for(ai_tmp=ai; ai_tmp!=NULL; ai_tmp=ai_tmp->ai_next){ num_hosts++; }
331 req=(ntp_message*)malloc(sizeof(ntp_message)*num_hosts);
332 if(req==NULL) die(STATE_UNKNOWN, "can not allocate ntp message array");
333 socklist=(int*)malloc(sizeof(int)*num_hosts);
334 if(socklist==NULL) die(STATE_UNKNOWN, "can not allocate socket array");
335 ufds=(struct pollfd*)malloc(sizeof(struct pollfd)*num_hosts);
336 if(ufds==NULL) die(STATE_UNKNOWN, "can not allocate socket array");
337 servers=(ntp_server_results*)malloc(sizeof(ntp_server_results)*num_hosts);
338 if(servers==NULL) die(STATE_UNKNOWN, "can not allocate server array");
339 memset(servers, 0, sizeof(ntp_server_results)*num_hosts);
341 /* setup each socket for writing, and the corresponding struct pollfd */
342 ai_tmp=ai;
343 for(i=0;ai_tmp;i++){
344 socklist[i]=socket(ai_tmp->ai_family, SOCK_DGRAM, IPPROTO_UDP);
345 if(socklist[i] == -1) {
346 perror(NULL);
347 die(STATE_UNKNOWN, "can not create new socket");
348 }
349 if(connect(socklist[i], ai_tmp->ai_addr, ai_tmp->ai_addrlen)){
350 die(STATE_UNKNOWN, "can't create socket connection");
351 } else {
352 ufds[i].fd=socklist[i];
353 ufds[i].events=POLLIN;
354 ufds[i].revents=0;
355 }
356 ai_tmp = ai_tmp->ai_next;
357 }
359 /* now do AVG_NUM checks to each host. We stop before timeout/2 seconds
360 * have passed in order to ensure post-processing and jitter time. */
361 now_time=start_ts=time(NULL);
362 while(servers_completed<num_hosts && now_time-start_ts <= socket_timeout/2){
363 /* loop through each server and find each one which hasn't
364 * been touched in the past second or so and is still lacking
365 * some responses. For each of these servers, send a new request,
366 * and update the "waiting" timestamp with the current time. */
367 one_written=0;
368 now_time=time(NULL);
370 for(i=0; i<num_hosts; i++){
371 if(servers[i].waiting<now_time && servers[i].num_responses<AVG_NUM){
372 if(verbose && servers[i].waiting != 0) printf("re-");
373 if(verbose) printf("sending request to peer %d\n", i);
374 setup_request(&req[i]);
375 write(socklist[i], &req[i], sizeof(ntp_message));
376 servers[i].waiting=now_time;
377 one_written=1;
378 break;
379 }
380 }
382 /* quickly poll for any sockets with pending data */
383 servers_readable=poll(ufds, num_hosts, 100);
384 if(servers_readable==-1){
385 perror("polling ntp sockets");
386 die(STATE_UNKNOWN, "communication errors");
387 }
389 /* read from any sockets with pending data */
390 for(i=0; servers_readable && i<num_hosts; i++){
391 if(ufds[i].revents&POLLIN && servers[i].num_responses < AVG_NUM){
392 if(verbose) {
393 printf("response from peer %d: ", i);
394 }
396 read(ufds[i].fd, &req[i], sizeof(ntp_message));
397 gettimeofday(&recv_time, NULL);
398 DBG(print_ntp_message(&req[i]));
399 respnum=servers[i].num_responses++;
400 servers[i].offset[respnum]=calc_offset(&req[i], &recv_time);
401 if(verbose) {
402 printf("offset %.10g\n", servers[i].offset[respnum]);
403 }
404 servers[i].stratum=req[i].stratum;
405 servers[i].rtdisp=NTP32asDOUBLE(req[i].rtdisp);
406 servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay);
407 servers[i].waiting=0;
408 servers[i].flags=req[i].flags;
409 servers_readable--;
410 one_read = 1;
411 if(servers[i].num_responses==AVG_NUM) servers_completed++;
412 }
413 }
414 /* lather, rinse, repeat. */
415 }
417 if (one_read == 0) {
418 die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
419 }
421 /* now, pick the best server from the list */
422 best_index=best_offset_server(servers, num_hosts);
423 if(best_index < 0){
424 *status=STATE_UNKNOWN;
425 } else {
426 /* finally, calculate the average offset */
427 for(i=0; i<servers[best_index].num_responses;i++){
428 avg_offset+=servers[best_index].offset[j];
429 }
430 avg_offset/=servers[best_index].num_responses;
431 }
433 /* cleanup */
434 for(j=0; j<num_hosts; j++){ close(socklist[j]); }
435 free(socklist);
436 free(ufds);
437 free(servers);
438 free(req);
439 freeaddrinfo(ai);
441 if(verbose) printf("overall average offset: %.10g\n", avg_offset);
442 return avg_offset;
443 }
445 int process_arguments(int argc, char **argv){
446 int c;
447 int option=0;
448 static struct option longopts[] = {
449 {"version", no_argument, 0, 'V'},
450 {"help", no_argument, 0, 'h'},
451 {"verbose", no_argument, 0, 'v'},
452 {"use-ipv4", no_argument, 0, '4'},
453 {"use-ipv6", no_argument, 0, '6'},
454 {"quiet", no_argument, 0, 'q'},
455 {"warning", required_argument, 0, 'w'},
456 {"critical", required_argument, 0, 'c'},
457 {"timeout", required_argument, 0, 't'},
458 {"hostname", required_argument, 0, 'H'},
459 {0, 0, 0, 0}
460 };
463 if (argc < 2)
464 usage ("\n");
466 while (1) {
467 c = getopt_long (argc, argv, "Vhv46qw:c:t:H:", longopts, &option);
468 if (c == -1 || c == EOF || c == 1)
469 break;
471 switch (c) {
472 case 'h':
473 print_help();
474 exit(STATE_OK);
475 break;
476 case 'V':
477 print_revision(progname, revision);
478 exit(STATE_OK);
479 break;
480 case 'v':
481 verbose++;
482 break;
483 case 'q':
484 quiet = 1;
485 break;
486 case 'w':
487 owarn = optarg;
488 break;
489 case 'c':
490 ocrit = optarg;
491 break;
492 case 'H':
493 if(is_host(optarg) == FALSE)
494 usage2(_("Invalid hostname/address"), optarg);
495 server_address = strdup(optarg);
496 break;
497 case 't':
498 socket_timeout=atoi(optarg);
499 break;
500 case '4':
501 address_family = AF_INET;
502 break;
503 case '6':
504 #ifdef USE_IPV6
505 address_family = AF_INET6;
506 #else
507 usage4 (_("IPv6 support not available"));
508 #endif
509 break;
510 case '?':
511 /* print short usage statement if args not parsable */
512 usage5 ();
513 break;
514 }
515 }
517 if(server_address == NULL){
518 usage4(_("Hostname was not supplied"));
519 }
521 return 0;
522 }
524 char *perfd_offset (double offset)
525 {
526 return fperfdata ("offset", offset, "s",
527 TRUE, offset_thresholds->warning->end,
528 TRUE, offset_thresholds->critical->end,
529 FALSE, 0, FALSE, 0);
530 }
532 int main(int argc, char *argv[]){
533 int result, offset_result;
534 double offset=0;
535 char *result_line, *perfdata_line;
537 result = offset_result = STATE_OK;
539 if (process_arguments (argc, argv) == ERROR)
540 usage4 (_("Could not parse arguments"));
542 set_thresholds(&offset_thresholds, owarn, ocrit);
544 /* initialize alarm signal handling */
545 signal (SIGALRM, socket_timeout_alarm_handler);
547 /* set socket timeout */
548 alarm (socket_timeout);
550 offset = offset_request(server_address, &offset_result);
551 if (offset_result == STATE_UNKNOWN) {
552 result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL);
553 } else {
554 result = get_status(fabs(offset), offset_thresholds);
555 }
557 switch (result) {
558 case STATE_CRITICAL :
559 asprintf(&result_line, _("NTP CRITICAL:"));
560 break;
561 case STATE_WARNING :
562 asprintf(&result_line, _("NTP WARNING:"));
563 break;
564 case STATE_OK :
565 asprintf(&result_line, _("NTP OK:"));
566 break;
567 default :
568 asprintf(&result_line, _("NTP UNKNOWN:"));
569 break;
570 }
571 if(offset_result == STATE_UNKNOWN){
572 asprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
573 asprintf(&perfdata_line, "");
574 } else {
575 asprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset);
576 asprintf(&perfdata_line, "%s", perfd_offset(offset));
577 }
578 printf("%s|%s\n", result_line, perfdata_line);
580 if(server_address!=NULL) free(server_address);
581 return result;
582 }
584 void print_help(void){
585 print_revision(progname, revision);
587 printf ("Copyright (c) 2006 Sean Finney\n");
588 printf (COPYRIGHT, copyright, email);
590 printf ("%s\n", _("This plugin checks the clock offset with the ntp server"));
592 printf ("\n\n");
594 print_usage();
595 printf (_(UT_HELP_VRSN));
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"));
599 printf (" %s\n", "-w, --warning=THRESHOLD");
600 printf (" %s\n", _("Offset to result in warning status (seconds)"));
601 printf (" %s\n", "-c, --critical=THRESHOLD");
602 printf (" %s\n", _("Offset to result in critical status (seconds)"));
603 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
604 printf (_(UT_VERBOSE));
606 printf("\n");
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."));
614 printf(" %s\n", _("See:"));
615 printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT"));
616 printf(" %s\n", _("for THRESHOLD format and examples."));
618 printf("\n");
619 printf("%s\n", _("Examples:"));
620 printf(" %s\n", ("./check_ntp_time -H ntpserv -w 0.5 -c 1"));
622 printf (_(UT_SUPPORT));
623 }
625 void
626 print_usage(void)
627 {
628 printf (_("Usage:"));
629 printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname);
630 printf(" [-j <warn>] [-k <crit>] [-v verbose]\n");
631 }