diff options
| author | Sven Nierlein <sven@nierlein.de> | 2012-11-28 13:51:16 +0100 |
|---|---|---|
| committer | Sven Nierlein <sven@nierlein.de> | 2012-11-28 13:51:16 +0100 |
| commit | 6fde27e478207269d3b867ed36f5869ed5b86ba5 (patch) | |
| tree | 8a75b8f203c3cad0fe8b40eecbe78d17642ea60e /plugins | |
| parent | 24772e755e9d2a255e36eb2a97f545d2cb7ade3c (diff) | |
| download | monitoring-plugins-6fde27e478207269d3b867ed36f5869ed5b86ba5.tar.gz | |
check_ntp(_time): don't die on connect errors
connect errors may happen if clients check agains dual
stacked ipv4/6 ntp servers.
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_ntp.c | 6 | ||||
| -rw-r--r-- | plugins/check_ntp_time.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 7d18919f..16be7c51 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c | |||
| @@ -398,7 +398,11 @@ double offset_request(const char *host, int *status){ | |||
| 398 | die(STATE_UNKNOWN, "can not create new socket"); | 398 | die(STATE_UNKNOWN, "can not create new socket"); |
| 399 | } | 399 | } |
| 400 | if(connect(socklist[i], ai_tmp->ai_addr, ai_tmp->ai_addrlen)){ | 400 | if(connect(socklist[i], ai_tmp->ai_addr, ai_tmp->ai_addrlen)){ |
| 401 | die(STATE_UNKNOWN, "can't create socket connection"); | 401 | /* don't die here, because it is enough if there is one server |
| 402 | answering in time. This also would break for dual ipv4/6 stacked | ||
| 403 | ntp servers when the client only supports on of them. | ||
| 404 | */ | ||
| 405 | DBG(printf("can't create socket connection on peer %i: %s\n", i, strerror(errno))); | ||
| 402 | } else { | 406 | } else { |
| 403 | ufds[i].fd=socklist[i]; | 407 | ufds[i].fd=socklist[i]; |
| 404 | ufds[i].events=POLLIN; | 408 | ufds[i].events=POLLIN; |
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 86530fe5..bbcaa0ba 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c | |||
| @@ -344,7 +344,11 @@ double offset_request(const char *host, int *status){ | |||
| 344 | die(STATE_UNKNOWN, "can not create new socket"); | 344 | die(STATE_UNKNOWN, "can not create new socket"); |
| 345 | } | 345 | } |
| 346 | if(connect(socklist[i], ai_tmp->ai_addr, ai_tmp->ai_addrlen)){ | 346 | if(connect(socklist[i], ai_tmp->ai_addr, ai_tmp->ai_addrlen)){ |
| 347 | die(STATE_UNKNOWN, "can't create socket connection"); | 347 | /* don't die here, because it is enough if there is one server |
| 348 | answering in time. This also would break for dual ipv4/6 stacked | ||
| 349 | ntp servers when the client only supports on of them. | ||
| 350 | */ | ||
| 351 | DBG(printf("can't create socket connection on peer %i: %s\n", i, strerror(errno))); | ||
| 348 | } else { | 352 | } else { |
| 349 | ufds[i].fd=socklist[i]; | 353 | ufds[i].fd=socklist[i]; |
| 350 | ufds[i].events=POLLIN; | 354 | ufds[i].events=POLLIN; |
