[CentOS-virt] Time

Mauricio Tavares raubvogel at gmail.com
Tue Feb 12 16:49:42 UTC 2013


On Thu, Jan 3, 2013 at 9:01 PM, Nico Kadel-Garcia <nkadel at gmail.com> wrote:
> On Jan 2, 2013, at 19:27, "James B. Byrne" <byrnejb at harte-lyne.ca> wrote:
>
>> I do that as well.  However, I run one on each host just to serve its
>> own guests and configure the host to run off our central ntp server.
>
> Unfortunately, before our upstream vendor's OS release 6, ntp.conf
> listed several loopback addresses by default. These allowed a confused
> ntpd to basically marry its siblings and eventually crossbreed itself
> to a fairly stange state. But it will report ntpd as active, which is
> why the Nagios check "chek_ntp_)time"  actually compares the time to a
> known good upstream NTP service.
>
      Dumb question: why not use the vm host's clock instead? I am
coming from libvirt but I would assume (bad idea I know) that if
libvirt can see the host's clock in the client, so can kvm. If that is
the case, something like

hwclock -s -u

should keep them in sync. I wrote a little cron job (see
http://unixwars.blogspot.com/2013/01/restoring-time-on-sleeping-linux-vms.html)
to compare the client time with the host. If the drift is large
enough, sync them back. The reason for the cron job is so it works
after client wakes up from a slumber. Just throwing an idea out there.

On a side note, yes I did also write another script using ntpq and
ntpdate to adjust time using ntp. I guess each solution has its
merits. =)

>>>> 4.  On each guest have a cron job that checks for ntpd at regular
>>>> intervals which reports failures and restarts the time service as
>>>> necessary. We use:
>>>>  JOBNAME="Check ntpd status and restart if required" ; \
>>>>    ntpstat > /dev/null && \
>>>>    if [[ $? -gt 0 ]]; then /sbin/service ntpd start; fi
>>> Why not configure the ntpd daemon and stick with that?
>>> It does update on its own [1]. And ntpstat prints out the interval,
>>> which matches the one mentioned at [1].
>>> I don't believe the ntpstat script/job is necessary (I've never had to
>>> do more than set ntpd to run after configuring the servers it should
>>> poll).
>
> See above. The 'check_ntp_time' tool is much more flexible and complete.
> itten does work. It's part of the "nagios-plugions-ntp" package,
> available from EPEL and RPMforge.
> _______________________________________________
> CentOS-virt mailing list
> CentOS-virt at centos.org
> http://lists.centos.org/mailman/listinfo/centos-virt


More information about the CentOS-virt mailing list