diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | plugins/check_ntp.c | 9 |
3 files changed, 11 insertions, 0 deletions
@@ -31,6 +31,7 @@ This file documents the major additions and syntax changes between releases. | |||
31 | Check_radius now supports radiusclient-ng | 31 | Check_radius now supports radiusclient-ng |
32 | Check_by_ssh now supports multiline output | 32 | Check_by_ssh now supports multiline output |
33 | IPv6 support can now be disabled using ./configure --without-ipv6 | 33 | IPv6 support can now be disabled using ./configure --without-ipv6 |
34 | Fix check_ntp now honor ntp flags | ||
34 | 35 | ||
35 | 1.4.9 4th June 2006 | 36 | 1.4.9 4th June 2006 |
36 | Inclusion of contrib/check_cluster2 as check_cluster with some improvements | 37 | Inclusion of contrib/check_cluster2 as check_cluster with some improvements |
@@ -225,3 +225,4 @@ Christoph Schell | |||
225 | Andrew Elwell | 225 | Andrew Elwell |
226 | Heiti Ernits | 226 | Heiti Ernits |
227 | Sebastien Guay | 227 | Sebastien Guay |
228 | MAtteo HCE Valsasna | ||
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 28c23d8..abd254c 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c | |||
@@ -86,6 +86,7 @@ typedef struct { | |||
86 | double rtdelay; /* converted from the ntp_message */ | 86 | double rtdelay; /* converted from the ntp_message */ |
87 | double rtdisp; /* converted from the ntp_message */ | 87 | double rtdisp; /* converted from the ntp_message */ |
88 | double offset[AVG_NUM]; /* offsets from each response */ | 88 | double offset[AVG_NUM]; /* offsets from each response */ |
89 | uint8_t flags; /* byte with leapindicator,vers,mode. see macros */ | ||
89 | } ntp_server_results; | 90 | } ntp_server_results; |
90 | 91 | ||
91 | /* this structure holds everything in an ntp control message as per rfc1305 */ | 92 | /* this structure holds everything in an ntp control message as per rfc1305 */ |
@@ -302,6 +303,12 @@ int best_offset_server(const ntp_server_results *slist, int nservers){ | |||
302 | 303 | ||
303 | /* for each server */ | 304 | /* for each server */ |
304 | for(cserver=0; cserver<nservers; cserver++){ | 305 | for(cserver=0; cserver<nservers; cserver++){ |
306 | /* sort out servers with error flags */ | ||
307 | if ( LI(slist[cserver].flags) != LI_NOWARNING ){ | ||
308 | if (verbose) printf("discarding peer id %d: flags=%d\n", cserver, LI(slist[cserver].flags)); | ||
309 | break; | ||
310 | } | ||
311 | |||
305 | /* compare it to each of the servers already in the candidate list */ | 312 | /* compare it to each of the servers already in the candidate list */ |
306 | for(i=0; i<csize; i++){ | 313 | for(i=0; i<csize; i++){ |
307 | /* does it have an equal or better stratum? */ | 314 | /* does it have an equal or better stratum? */ |
@@ -450,6 +457,7 @@ double offset_request(const char *host, int *status){ | |||
450 | servers[i].rtdisp=NTP32asDOUBLE(req[i].rtdisp); | 457 | servers[i].rtdisp=NTP32asDOUBLE(req[i].rtdisp); |
451 | servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay); | 458 | servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay); |
452 | servers[i].waiting=0; | 459 | servers[i].waiting=0; |
460 | servers[i].flags=req[i].flags; | ||
453 | servers_readable--; | 461 | servers_readable--; |
454 | one_read = 1; | 462 | one_read = 1; |
455 | if(servers[i].num_responses==AVG_NUM) servers_completed++; | 463 | if(servers[i].num_responses==AVG_NUM) servers_completed++; |
@@ -808,6 +816,7 @@ int main(int argc, char *argv[]){ | |||
808 | } | 816 | } |
809 | if(offset_result==STATE_CRITICAL){ | 817 | if(offset_result==STATE_CRITICAL){ |
810 | asprintf(&result_line, "%s %s", result_line, _("Offset unknown")); | 818 | asprintf(&result_line, "%s %s", result_line, _("Offset unknown")); |
819 | asprintf(&perfdata_line, ""); | ||
811 | } else { | 820 | } else { |
812 | if(offset_result==STATE_WARNING){ | 821 | if(offset_result==STATE_WARNING){ |
813 | asprintf(&result_line, "%s %s", result_line, _("Unable to fully sample sync server")); | 822 | asprintf(&result_line, "%s %s", result_line, _("Unable to fully sample sync server")); |