[Nagiosplug-devel] [ nagiosplug-Bugs-3552882 ] check_ntp_time and check_ntp return just first offset

SourceForge.net noreply at sourceforge.net
Wed Aug 1 02:54:31 CEST 2012


Bugs item #3552882, was opened at 2012-07-31 17:54
Message generated for change (Tracker Item Submitted) made by 
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3552882&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General plugin execution
Group: snapshot tarball
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: https://www.google.com/accounts ()
Assigned to: Nobody/Anonymous (nobody)
Summary: check_ntp_time and check_ntp return just first offset

Initial Comment:
Both check_ntp_time and check_ntp return just first measured offset, instead of wanted average of four measurements. There is used bad index j (equeal to 0) instead of correct index i in avg_offset loop:

	for(i=0; i<servers[best_index].num_responses;i++){
		avg_offset+=servers[best_index].offset[j];
	}

So avg_offset counts num_responses times the same first measured offset, then it is divided by num_responses, and first measured offset is back in avg_offset, instead of wanted average.

Also, I think that counting just an arithmetic average is not very good thing. For example, when there are measured values 0.001, 1.000, 0.001 and 0.001, the result will be 0.25075, whereas I think that there should be some logic, which skips obviously bad value 1.000, and result should be 0.001.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3552882&group_id=29880




More information about the Devel mailing list