check_ntp

Paul L. Allen pla at softflare.com
Mon Jun 14 20:02:09 CEST 2004


Spencer Horn writes: 

> Why would NTP be alarming critical if the offset is less than 60 seconds?

It isn't returning critical because the offset is less than 60s, it is
returning critical because the offset is 0s.  Yes, I know that 0 is
leass than 60, but you would get OK for 0.1s, 0.01s, 0.001s, 0.0001s... 

0s is special-cased.  The code assumes that an offset of 0s is bogus
because it assumes that nobody is running a stratum 0 server.  For most
people, that is true. :) 

> 	CRITICAL 	06-14-2004 12:25:28 	17d 3h 9m 6s 	1/1 
>	server 208.62.207.124, stratum 0, offset 0.000000, delay 0.00000 

There's your problem.   Your server is at stratum zero, so the offset is
(normally) exactly 0, which check_ntp decides can't be right. 

I'd suggest search for the word "bogus" and then a couple of lines down
from that change: 

   if ($offset == 0) {undef $offset;} 

to: 

   if ($offset == 0 and $stratum) {undef $offset;} 

Note: the above has not been tested and it's been another long day, so
no guarantees. 

Actually, I'd change it to: 

   undef $offset if ($offset == 0 and $stratum); 

because that is more idiomatic perl and executes fractionally faster. 

Actually, I'd change it to: 

   undef $offset unless ($offset or not $stratum); 

because that's even more idiomatic perl.  There is always more than one
way to do it. 

-- 
Paul Allen
Softflare Support 




-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list