Revision: 1799
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1799&view=rev
Author: dermoth
Date: 2007-09-25 21:16:21 -0700 (Tue, 25 Sep 2007)
Log Message:
-----------
Patch #1798774: check_ntp: honor ntp flags
Modified Paths:
--------------
nagiosplug/trunk/NEWS
nagiosplug/trunk/THANKS.in
nagiosplug/trunk/plugins/check_ntp.c
Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS 2007-09-24 19:34:48 UTC (rev 1798)
+++ nagiosplug/trunk/NEWS 2007-09-26 04:16:21 UTC (rev 1799)
@@ -31,6 +31,7 @@
Check_radius now supports radiusclient-ng
Check_by_ssh now supports multiline output
IPv6 support can now be disabled using ./configure --without-ipv6
+ Fix check_ntp now honor ntp flags
1.4.9 4th June 2006
Inclusion of contrib/check_cluster2 as check_cluster with some improvements
Modified: nagiosplug/trunk/THANKS.in
===================================================================
--- nagiosplug/trunk/THANKS.in 2007-09-24 19:34:48 UTC (rev 1798)
+++ nagiosplug/trunk/THANKS.in 2007-09-26 04:16:21 UTC (rev 1799)
@@ -225,3 +225,4 @@
Andrew Elwell
Heiti Ernits
Sebastien Guay
+MAtteo HCE Valsasna
Modified: nagiosplug/trunk/plugins/check_ntp.c
===================================================================
--- nagiosplug/trunk/plugins/check_ntp.c 2007-09-24 19:34:48 UTC (rev 1798)
+++ nagiosplug/trunk/plugins/check_ntp.c 2007-09-26 04:16:21 UTC (rev 1799)
@@ -86,6 +86,7 @@
double rtdelay; /* converted from the ntp_message */
double rtdisp; /* converted from the ntp_message */
double offset[AVG_NUM]; /* offsets from each response */
+ uint8_t flags; /* byte with leapindicator,vers,mode. see macros */
} ntp_server_results;
/* this structure holds everything in an ntp control message as per rfc1305 */
@@ -302,6 +303,12 @@
/* for each server */
for(cserver=0; cserver<nservers; cserver++){
+ /* sort out servers with error flags */
+ if ( LI(slist[cserver].flags) != LI_NOWARNING ){
+ if (verbose) printf("discarding peer id %d: flags=%d\n", cserver, LI(slist[cserver].flags));
+ break;
+ }
+
/* compare it to each of the servers already in the candidate list */
for(i=0; i<csize; i++){
/* does it have an equal or better stratum? */
@@ -450,6 +457,7 @@
servers[i].rtdisp=NTP32asDOUBLE(req[i].rtdisp);
servers[i].rtdelay=NTP32asDOUBLE(req[i].rtdelay);
servers[i].waiting=0;
+ servers[i].flags=req[i].flags;
servers_readable--;
one_read = 1;
if(servers[i].num_responses==AVG_NUM) servers_completed++;
@@ -808,6 +816,7 @@
}
if(offset_result==STATE_CRITICAL){
asprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
+ asprintf(&perfdata_line, "");
} else {
if(offset_result==STATE_WARNING){
asprintf(&result_line, "%s %s", result_line, _("Unable to fully sample sync server"));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.