[nagiosplug] check_ntp(_time): don't die on connect errors
"Nagios Plugin Development" <[email protected]> Wed, 28 Nov 2012 13:01:12 +0000
| Newsgroups | gmane.network.nagios.plugins.cvs |
|---|---|
| Message-ID | <[email protected]> |
Module: nagiosplug Branch: master Commit: 6fde27e478207269d3b867ed36f5869ed5b86ba5 Author: Sven Nierlein <[email protected]> Date: Wed Nov 28 13:51:16 2012 +0100 URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=6fde27e check_ntp(_time): don't die on connect errors connect errors may happen if clients check agains dual stacked ipv4/6 ntp servers. --- plugins/check_ntp.c | 6 +++++- 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 7d18919..16be7c5 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c @@ -398,7 +398,11 @@ double offset_request(const char *host, int *status){ die(STATE_UNKNOWN, "can not create new socket"); } if(connect(socklist[i], ai_tmp->ai_addr, ai_tmp->ai_addrlen)){ - die(STATE_UNKNOWN, "can't create socket connection"); + /* don't die here, because it is enough if there is one server + answering in time. This also would break for dual ipv4/6 stacked + ntp servers when the client only supports on of them. + */ + DBG(printf("can't create socket connection on peer %i: %s\n", i, strerror(errno))); } else { ufds[i].fd=socklist[i]; ufds[i].events=POLLIN; diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 86530fe..bbcaa0b 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){ die(STATE_UNKNOWN, "can not create new socket"); } if(connect(socklist[i], ai_tmp->ai_addr, ai_tmp->ai_addrlen)){ - die(STATE_UNKNOWN, "can't create socket connection"); + /* don't die here, because it is enough if there is one server + answering in time. This also would break for dual ipv4/6 stacked + ntp servers when the client only supports on of them. + */ + DBG(printf("can't create socket connection on peer %i: %s\n", i, strerror(errno))); } else { ufds[i].fd=socklist[i]; ufds[i].events=POLLIN; ------------------------------------------------------------------------------ Keep yourself connected to Go Parallel: INSIGHTS What's next for parallel hardware, programming and related areas? Interviews and blogs by thought leaders keep you ahead of the curve. http://goparallel.sourceforge.net