Hi there. I did just set up a Linux box to time synchronize to a Cisco
router. I would like to have a way to know whenever the Linux box
stops synchronizing (because of any network connecticity issue, for
instance). any ideas?
Printable View
Hi there. I did just set up a Linux box to time synchronize to a Cisco
router. I would like to have a way to know whenever the Linux box
stops synchronizing (because of any network connecticity issue, for
instance). any ideas?
[email]eespejel@gmail.com[/email] wrote:[color=blue]
> Hi there. I did just set up a Linux box to time synchronize to a Cisco
> router. I would like to have a way to know whenever the Linux box
> stops synchronizing (because of any network connecticity issue, for
> instance). any ideas?[/color]
Poll it with an NTP client and check the stratum. Use ntpq to check the
stratum. If it is using the kernel time discipline, monitor the kernel
estimate of error (and possibly the state of the kernel discipline).
Note that a lost server doesn't mean the time is wrong, as it will coast
along with the last known frequency correction.
On Tue, Apr 22, 2008 at 3:50 PM, <eespejel@gmail.com> wrote:[color=blue]
> Hi there. I did just set up a Linux box to time synchronize to a Cisco
> router. I would like to have a way to know whenever the Linux box
> stops synchronizing (because of any network connecticity issue, for
> instance). any ideas?[/color]
Run a script on the Linux box that periodically calls "ntpq -q
localhost", then parses the output. The script should check that the
line for Cisco your router begins with an asterisk in the ntpq -q output.
This means your router has been selected as the synchronization source
by the clock filter. If it doesn't have an asterisk, have the script
do whatever alert action you want - email, syslog, etc.
If you have more than one server configured in your ntpd, you will
have to add some smarts to handle or ignore those as appropriate.
I do not have an example script, unfortunately.
--
RPM
[email]eespejel@gmail.com[/email] writes:
[color=blue]
>Hi there. I did just set up a Linux box to time synchronize to a Cisco
>router. I would like to have a way to know whenever the Linux box
>stops synchronizing (because of any network connecticity issue, for
>instance). any ideas?[/color]
$!/bin/sh
if ! ntpq|grep '* name.of.router'>/dev/null; then
mail -s "NTP sync has been lost" [email]your.name@youremil.com[/email]
fi
And put the shell script into crontab to run every minute.
(your milage may vary)
[color=blue]
>$!/bin/sh
>if ! ntpq|grep '* name.of.router'>/dev/null; then
> mail -s "NTP sync has been lost" [email]your.name@youremil.com[/email]
>fi
>
>And put the shell script into crontab to run every minute.
>(your milage may vary)[/color]
That could lead to a lot of clutter in your mailbox.
--
These are my opinions, not necessarily my employer's. I hate spam.
[email]hal-usenet@ip-64-139-1-69.sjc.megapath.net[/email] (Hal Murray) writes:
[color=blue][color=green]
>>$!/bin/sh
>>if ! ntpq|grep '* name.of.router'>/dev/null; then
>> mail -s "NTP sync has been lost" [email]your.name@youremil.com[/email]
>>fi
>>
>>And put the shell script into crontab to run every minute.
>>(your milage may vary)[/color][/color]
[color=blue]
>That could lead to a lot of clutter in your mailbox.[/color]
Yup, it sure could. But you would know when something went wrong.
(Of course you could become more sophisticated and not send the mail if the
last time the shell ran, mail was sent, etc. ) All I am pointing out to the
Op is that running a cron shell can be used to notify. How often he wants
to be notified, etc, it up to him.
>>> In article <c6423bc2-76d7-432c-a7fa-117b327fd3ec@y21g2000hsf.googlegroups.com>, [email]eespejel@gmail.com[/email] writes:
eespejel> Hi there. I did just set up a Linux box to time synchronize to a
eespejel> Cisco router. I would like to have a way to know whenever the
eespejel> Linux box stops synchronizing (because of any network connecticity
eespejel> issue, for instance). any ideas?
[url]http://support.ntp.org/bin/view/Support/MonitoringAndControllingNTP[/url]
--
Harlan Stenn <stenn@ntp.org>
[url]http://ntpforum.isc.org[/url] - be a member!