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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 9cda277..f9dc49a 100644
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
@@ -335,7 +335,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){
335 * we have to do it in a way that our lazy macros don't handle currently :( */ 335 * we have to do it in a way that our lazy macros don't handle currently :( */
336double offset_request(const char *host, int *status){ 336double offset_request(const char *host, int *status){
337 int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0; 337 int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0;
338 int servers_completed=0, one_written=0, servers_readable=0, best_index=-1; 338 int servers_completed=0, one_written=0, one_read=0, servers_readable=0, best_index=-1;
339 time_t now_time=0, start_ts=0; 339 time_t now_time=0, start_ts=0;
340 ntp_message *req=NULL; 340 ntp_message *req=NULL;
341 double avg_offset=0.; 341 double avg_offset=0.;
@@ -437,12 +437,17 @@ double offset_request(const char *host, int *status){
437 servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay); 437 servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay);
438 servers[i].waiting=0; 438 servers[i].waiting=0;
439 servers_readable--; 439 servers_readable--;
440 one_read = 1;
440 if(servers[i].num_responses==AVG_NUM) servers_completed++; 441 if(servers[i].num_responses==AVG_NUM) servers_completed++;
441 } 442 }
442 } 443 }
443 /* lather, rinse, repeat. */ 444 /* lather, rinse, repeat. */
444 } 445 }
445 446
447 if (one_read == 0) {
448 die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
449 }
450
446 /* now, pick the best server from the list */ 451 /* now, pick the best server from the list */
447 best_index=best_offset_server(servers, num_hosts); 452 best_index=best_offset_server(servers, num_hosts);
448 if(best_index < 0){ 453 if(best_index < 0){