Jeremy Kister on 7 Jan 2014 03:52:29 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Quick & Dirty NTP monitoring


On 1/4/2014 3:51 PM, JP Vossen wrote:
So...  Anyone have a better quick & dirty method for this?  And if not,
steal this one...

If your ntp server can't sync time, your test is actually doing it's job by crying. You can add some retries in there if you can't get the core issue solved.

I can't say better, but i'd use some perl to actually query the ntp. You can jam it all on one line easily.

perl -MNet::NTP -e '
for($i; $i<3; $i++){
 %r=get_ntp_response("127.0.0.1");
 if( $r{Stratum} <= 4 && $r{"Receive Timestamp"} >= time()-600 ){
  $s=1;
  last;
 }
 sleep 60;
}
print "error with ntp server\n" unless $s;'

--

Jeremy Kister
http://jeremy.kister.net./
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug