[Nagiosplug-devel] [ nagiosplug-Patches-1159317 ] Patch for check_ntp to work with zero offsets

SourceForge.net noreply at sourceforge.net
Tue Mar 8 14:28:31 CET 2005


Patches item #1159317, was opened at 2005-03-08 19:55
Message generated for change (Comment added) made by tonvoon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1159317&group_id=29880

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: W Sanders (wsanders1)
>Assigned to: Ton Voon (tonvoon)
Summary: Patch for check_ntp to work with zero offsets

Initial Comment:
In some (mine) LANS with "perfectly" synchronized
clocks the offset can be zero even though the ntp
daemon is all synced up. "Check_ntp" assumes a zero
offset is an unsynchronized ntpd. The way I got it to
work was to also check for stratum 16, which is also a
sign of zero offset. No need to be paranoid unless you
are sure they are out to get you! Diff -c below:

$ diff -c ../../libexec/check_ntp.0 ../../libexec/check_ntp
*** ../../libexec/check_ntp.0   2005-02-04
13:59:50.000000000 -0800
--- ../../libexec/check_ntp     2005-02-04
14:18:24.000000000 -0800
***************
*** 194,200 ****

                # An offset of 0.000000 with an error
is probably bogus. Actually,
                # it's probably always bogus, but let's
be paranoid here.
!               if ($offset == 0) { undef $offset;}

                $ntpdate_error = defined ($offset) ?
$ERRORS{"OK"} : $ERRORS{"CRITICAL"};
                print "ntperr = $ntpdate_error \n" if
$verbose;
--- 194,200 ----

                # An offset of 0.000000 with an error
is probably bogus. Actually,
                # it's probably always bogus, but let's
be paranoid here.
!               if ($offset == 0 and $stratum == 16) {
undef $offset;}

                $ntpdate_error = defined ($offset) ?
$ERRORS{"OK"} : $ERRORS{"CRITICAL"};
                print "ntperr = $ntpdate_error \n" if
$verbose;


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

>Comment By: Ton Voon (tonvoon)
Date: 2005-03-08 22:27

Message:
Logged In: YES 
user_id=664364

I've applied a patch to check_ntp to remove this 0 test, but have to admit 
I'm not exactly sure what is happening here.

Can you say why an offset of 0.000 is good/bad?

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

Comment By: Jason Martin (jhmartin)
Date: 2005-03-08 20:44

Message:
Logged In: YES 
user_id=589094

This would probably be better implemented as a command-line
flag with the default behavior remaining as '0 = bad'.

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

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




More information about the Devel mailing list