summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_ntp.c')
-rw-r--r--plugins/check_ntp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 28c23d84..abd254c8 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"));