aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_ntp.c
diff options
context:
space:
mode:
authorGravatar Ton Voon <tonvoon@users.sourceforge.net> 2006-08-11 08:26:34 +0000
committerGravatar Ton Voon <tonvoon@users.sourceforge.net> 2006-08-11 08:26:34 +0000
commit0c2be6a608135d8a45c82a1c0ada5e8020bc2409 (patch)
treecc1c96e681de1de347a0e34eadf571d18c39de48 /plugins/check_ntp.c
parent4c50478efce19e079c030574e1b23bf02a50573a (diff)
downloadmonitoring-plugins-0c2be6a608135d8a45c82a1c0ada5e8020bc2409.tar.gz
Catch no responses from any server (1538341 - nmdias)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1467 f882894a-f735-0410-b71e-b25c423dba1c
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 9cda2776..f9dc49a4 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){
* we have to do it in a way that our lazy macros don't handle currently :( */
double offset_request(const char *host, int *status){
int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0;
- int servers_completed=0, one_written=0, servers_readable=0, best_index=-1;
+ int servers_completed=0, one_written=0, one_read=0, servers_readable=0, best_index=-1;
time_t now_time=0, start_ts=0;
ntp_message *req=NULL;
double avg_offset=0.;
@@ -437,12 +437,17 @@ double offset_request(const char *host, int *status){
servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay);
servers[i].waiting=0;
servers_readable--;
+ one_read = 1;
if(servers[i].num_responses==AVG_NUM) servers_completed++;
}
}
/* lather, rinse, repeat. */
}
+ if (one_read == 0) {
+ die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
+ }
+
/* now, pick the best server from the list */
best_index=best_offset_server(servers, num_hosts);
if(best_index < 0){