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=4; 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);
340 DBG(printf("Found %d peers to check\n", num_hosts));
342 /* setup each socket for writing, and the corresponding struct pollfd */
343 ai_tmp=ai;
344 for(i=0;ai_tmp;i++){
345 socklist[i]=socket(ai_tmp->ai_family, SOCK_DGRAM, IPPROTO_UDP);
346 if(socklist[i] == -1) {
347 perror(NULL);
348 die(STATE_UNKNOWN, "can not create new socket");
349 }
350 if(connect(socklist[i], ai_tmp->ai_addr, ai_tmp->ai_addrlen)){
351 die(STATE_UNKNOWN, "can't create socket connection");
352 } else {
353 ufds[i].fd=socklist[i];
354 ufds[i].events=POLLIN;
355 ufds[i].revents=0;
356 }
357 ai_tmp = ai_tmp->ai_next;
358 }
360 /* now do AVG_NUM checks to each host. We stop before timeout/2 seconds
361 * have passed in order to ensure post-processing and jitter time. */
362 now_time=start_ts=time(NULL);
363 while(servers_completed<num_hosts && now_time-start_ts <= socket_timeout/2){
364 /* loop through each server and find each one which hasn't
365 * been touched in the past second or so and is still lacking
366 * some responses. For each of these servers, send a new request,
367 * and update the "waiting" timestamp with the current time. */
368 one_written=0;
369 now_time=time(NULL);
371 for(i=0; i<num_hosts; i++){
372 if(servers[i].waiting<now_time && servers[i].num_responses<AVG_NUM){
373 if(verbose && servers[i].waiting != 0) printf("re-");
374 if(verbose) printf("sending request to peer %d\n", i);
375 setup_request(&req[i]);
376 write(socklist[i], &req[i], sizeof(ntp_message));
377 servers[i].waiting=now_time;
378 one_written=1;
379 break;
380 }
381 }
383 /* quickly poll for any sockets with pending data */
384 servers_readable=poll(ufds, num_hosts, 100);
385 if(servers_readable==-1){
386 perror("polling ntp sockets");
387 die(STATE_UNKNOWN, "communication errors");
388 }
390 /* read from any sockets with pending data */
391 for(i=0; servers_readable && i<num_hosts; i++){
392 if(ufds[i].revents&POLLIN && servers[i].num_responses < AVG_NUM){
393 if(verbose) {
394 printf("response from peer %d: ", i);
395 }
397 read(ufds[i].fd, &req[i], sizeof(ntp_message));
398 gettimeofday(&recv_time, NULL);
399 DBG(print_ntp_message(&req[i]));
400 respnum=servers[i].num_responses++;
401 servers[i].offset[respnum]=calc_offset(&req[i], &recv_time);
402 if(verbose) {
403 printf("offset %.10g\n", servers[i].offset[respnum]);
404 }
405 servers[i].stratum=req[i].stratum;
406 servers[i].rtdisp=NTP32asDOUBLE(req[i].rtdisp);
407 servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay);
408 servers[i].waiting=0;
409 servers[i].flags=req[i].flags;
410 servers_readable--;
411 one_read = 1;
412 if(servers[i].num_responses==AVG_NUM) servers_completed++;
413 }
414 }
415 /* lather, rinse, repeat. */
416 }
418 if (one_read == 0) {
419 die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
420 }
422 /* now, pick the best server from the list */
423 best_index=best_offset_server(servers, num_hosts);
424 if(best_index < 0){
425 *status=STATE_UNKNOWN;
426 } else {
427 /* finally, calculate the average offset */
428 for(i=0; i<servers[best_index].num_responses;i++){
429 avg_offset+=servers[best_index].offset[j];
430 }
431 avg_offset/=servers[best_index].num_responses;
432 }
434 /* cleanup */
435 for(j=0; j<num_hosts; j++){ close(socklist[j]); }
436 free(socklist);
437 free(ufds);
438 free(servers);
439 free(req);
440 freeaddrinfo(ai);
442 if(verbose) printf("overall average offset: %.10g\n", avg_offset);
443 return avg_offset;
444 }
446 int process_arguments(int argc, char **argv){
447 int c;
448 int option=0;
449 static struct option longopts[] = {
450 {"version", no_argument, 0, 'V'},
451 {"help", no_argument, 0, 'h'},
452 {"verbose", no_argument, 0, 'v'},
453 {"use-ipv4", no_argument, 0, '4'},
454 {"use-ipv6", no_argument, 0, '6'},
455 {"quiet", no_argument, 0, 'q'},
456 {"warning", required_argument, 0, 'w'},
457 {"critical", required_argument, 0, 'c'},
458 {"timeout", required_argument, 0, 't'},
459 {"hostname", required_argument, 0, 'H'},
460 {0, 0, 0, 0}
461 };
464 if (argc < 2)
465 usage ("\n");
467 while (1) {
468 c = getopt_long (argc, argv, "Vhv46qw:c:t:H:", longopts, &option);
469 if (c == -1 || c == EOF || c == 1)
470 break;
472 switch (c) {
473 case 'h':
474 print_help();
475 exit(STATE_OK);
476 break;
477 case 'V':
478 print_revision(progname, revision);
479 exit(STATE_OK);
480 break;
481 case 'v':
482 verbose++;
483 break;
484 case 'q':
485 quiet = 1;
486 break;
487 case 'w':
488 owarn = optarg;
489 break;
490 case 'c':
491 ocrit = optarg;
492 break;
493 case 'H':
494 if(is_host(optarg) == FALSE)
495 usage2(_("Invalid hostname/address"), optarg);
496 server_address = strdup(optarg);
497 break;
498 case 't':
499 socket_timeout=atoi(optarg);
500 break;
501 case '4':
502 address_family = AF_INET;
503 break;
504 case '6':
505 #ifdef USE_IPV6
506 address_family = AF_INET6;
507 #else
508 usage4 (_("IPv6 support not available"));
509 #endif
510 break;
511 case '?':
512 /* print short usage statement if args not parsable */
513 usage5 ();
514 break;
515 }
516 }
518 if(server_address == NULL){
519 usage4(_("Hostname was not supplied"));
520 }
522 return 0;
523 }
525 char *perfd_offset (double offset)
526 {
527 return fperfdata ("offset", offset, "s",
528 TRUE, offset_thresholds->warning->end,
529 TRUE, offset_thresholds->critical->end,
530 FALSE, 0, FALSE, 0);
531 }
533 int main(int argc, char *argv[]){
534 int result, offset_result;
535 double offset=0;
536 char *result_line, *perfdata_line;
538 setlocale (LC_ALL, "");
539 bindtextdomain (PACKAGE, LOCALEDIR);
540 textdomain (PACKAGE);
542 result = offset_result = STATE_OK;
544 if (process_arguments (argc, argv) == ERROR)
545 usage4 (_("Could not parse arguments"));
547 set_thresholds(&offset_thresholds, owarn, ocrit);
549 /* initialize alarm signal handling */
550 signal (SIGALRM, socket_timeout_alarm_handler);
552 /* set socket timeout */
553 alarm (socket_timeout);
555 offset = offset_request(server_address, &offset_result);
556 if (offset_result == STATE_UNKNOWN) {
557 result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL);
558 } else {
559 result = get_status(fabs(offset), offset_thresholds);
560 }
562 switch (result) {
563 case STATE_CRITICAL :
564 asprintf(&result_line, _("NTP CRITICAL:"));
565 break;
566 case STATE_WARNING :
567 asprintf(&result_line, _("NTP WARNING:"));
568 break;
569 case STATE_OK :
570 asprintf(&result_line, _("NTP OK:"));
571 break;
572 default :
573 asprintf(&result_line, _("NTP UNKNOWN:"));
574 break;
575 }
576 if(offset_result == STATE_UNKNOWN){
577 asprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
578 asprintf(&perfdata_line, "");
579 } else {
580 asprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset);
581 asprintf(&perfdata_line, "%s", perfd_offset(offset));
582 }
583 printf("%s|%s\n", result_line, perfdata_line);
585 if(server_address!=NULL) free(server_address);
586 return result;
587 }
589 void print_help(void){
590 print_revision(progname, revision);
592 printf ("Copyright (c) 2006 Sean Finney\n");
593 printf (COPYRIGHT, copyright, email);
595 printf ("%s\n", _("This plugin checks the clock offset with the ntp server"));
597 printf ("\n\n");
599 print_usage();
600 printf (_(UT_HELP_VRSN));
601 printf (_(UT_HOST_PORT), 'p', "123");
602 printf (" %s\n", "-q, --quiet");
603 printf (" %s\n", _("Returns UNKNOWN instead of CRITICAL if offset cannot be found"));
604 printf (" %s\n", "-w, --warning=THRESHOLD");
605 printf (" %s\n", _("Offset to result in warning status (seconds)"));
606 printf (" %s\n", "-c, --critical=THRESHOLD");
607 printf (" %s\n", _("Offset to result in critical status (seconds)"));
608 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
609 printf (_(UT_VERBOSE));
611 printf("\n");
612 printf("%s\n", _("Notes:"));
613 printf(" %s\n", _("This plugin checks the clock offset between the local host and a"));
614 printf(" %s\n", _("remote NTP server. It is independent of any commandline programs or"));
615 printf(" %s\n\n", _("external libraries."));
616 printf(" %s\n", _("If you'd rather want to monitor an NTP server, please use"));
617 printf(" %s\n\n", _("check_ntp_peer."));
619 printf(" %s\n", _("See:"));
620 printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT"));
621 printf(" %s\n", _("for THRESHOLD format and examples."));
623 printf("\n");
624 printf("%s\n", _("Examples:"));
625 printf(" %s\n", ("./check_ntp_time -H ntpserv -w 0.5 -c 1"));
627 printf (_(UT_SUPPORT));
628 }
630 void
631 print_usage(void)
632 {
633 printf (_("Usage:"));
634 printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname);
635 printf(" [-j <warn>] [-k <crit>] [-v verbose]\n");
636 }