Page 1 of 2
time synch between guest OS and host using VMWare
Posted: Wed Sep 25, 2019 5:57 am
by Chris Hardick
Hi I am running Nagios XI 5.6.6, LogServer 2.0.8 & network analyser 2.4.0 from VMWare Workstation 15 Pro on Windows 10 PC, currently only monitoring a single windows 10 PC as we finalise configurations.
Win 10 PC is set to timezone UTC+00:00 London, with adjustment for daylight savings set
VMs are set identically, VMWare Tools - time synch on from VMWare Settings Option menu (synchronise guest time with host),but VMWare tools have not been installed - im assuming this is ok as VMWare allowed me to set the checkbox
Nagios XI (and others) are set to UTC+00:00 London
If i run command "date" within a VM it displays 1hr ahead of the Windows10 time, with indication that it is in BST. Windows 10 time is correct
eg at 16:00, WIn10 time indicates 16:00, NagiosXI VM indicates 17:00 BST
This is causing issues with time in traps being raised by NagiosXI being 1hr ahead of current time, and in Log Server I generally have to set query time to be 1hr ahead of current time to see current events.
Is there something I need to do to synchronise the times?
Thanks
Chris
Re: time synch between guest OS and host using VMWare
Posted: Wed Sep 25, 2019 9:18 am
by Chris Hardick
screenshot of host time details and timedatectl from VM
timesynch screenshot.png
Re: time synch between guest OS and host using VMWare
Posted: Wed Sep 25, 2019 9:52 am
by mbellerue
Let's try having the VM sync up with an NTP server. From your screenshot, it looks like NTP is enabled, but not synchronizing. Let's just plow through the commands to get it synchronizing. Run the following commands as root.
Code: Select all
yum install ntp ntpdate
systemctl start ntpd
systemctl enable ntpd
ntpdate -u -s 0.centos.pool.ntp.org 1.centos.pool.ntp.org 2.centos.pool.ntp.org
systemctl restart ntpd
Try these commands, and let me know if they help.
Re: time synch between guest OS and host using VMWare
Posted: Wed Sep 25, 2019 10:06 am
by Chris Hardick
Hi
The target environment will not have access to an NTP server (its an isolated system with no internet access), so I would prefer not to take this approach (target environment will utilise a custom application to synchronise all windows nodes). Can I synch with the host?
Thanks
Chris
Re: time synch between guest OS and host using VMWare
Posted: Wed Sep 25, 2019 10:54 am
by mbellerue
I definitely understand not wanting to rely on a workaround that won't be available when the VM gets to its final destination. But I'm also wondering if the issue at hand is also a product of its current environment. I think VMWare Workstation is just presenting the VM with the wrong time. We can check this by running,
and seeing if it is displaying 1 hour ahead. I think it will be. How we fix that is going to be a function of fixing something in VMWare Workstation, or having Linux force the VM clock to be a different time, which may or may not stick through a complete shutdown of the VM.
Would it be possible to throw the VM up in a test environment to see if the time would correct itself in an environment similar to production?
Re: time synch between guest OS and host using VMWare
Posted: Thu Sep 26, 2019 3:10 am
by Chris Hardick
Hi
I currently have the VM running in an isolated environment, so I can be fairly flexible in what is attempted.
The output of hwclock is shown below
hwclock output.png
for clarity, the three commands were run within a few seconds
Thanks
Re: time synch between guest OS and host using VMWare
Posted: Thu Sep 26, 2019 9:41 am
by mbellerue
Interesting that it's drifting by a few minutes like that. But the hardware clock that VMWare is presenting to the VM is showing roughly the same time, so I'm about as certain as I can be that it's a VMWare config issue. Why VMWare is presenting the correct time to two other VMs, I don't know. It may be that VMWare Tools do need to be installed for the time sync to work. Is installing VMWare tools an option for your environment?
Re: time synch between guest OS and host using VMWare
Posted: Thu Sep 26, 2019 10:24 am
by Chris Hardick
Installing the tools is OK.
I have just tried using the VMware workstation men option to install VMWare tools. It states I need to mount the virtual cd, launch a terminal, use tar to uncompress the installer then execute VMware-install - unfortunately when I try to unzip the only zipped file (VMwaretools-10.3.10-12406962.tar.gz, file size is 56435756) I get an error that it cannot open the file - im following the instructions here
https://docs.vmware.com/en/VMware-Works ... 8166F.html
vmware tools install.png
I will try again tomorrow, look's like the VMWare help doesn't match what is being mounted maybe?
Thanks
Chris
Re: time synch between guest OS and host using VMWare
Posted: Thu Sep 26, 2019 11:12 am
by mbellerue
Oh, it looks like your command is not case sensitive. The file is VMwareTools-yadda-yadda-yadda, and you've got vmwaretools-yadda-yadda-yadda. Also I think that VMWare mounts its tools as a virtual CDROM, so /mnt/cdrom may be read only. You might need to copy the VMWareTools file to /tmp or some other writable place.
Re: time synch between guest OS and host using VMWare
Posted: Fri Sep 27, 2019 8:00 am
by Chris Hardick
Hi
I managed to unpack the tar file, and have run the script, unfortunately it has reached a point where it is asking me for the location of kernel header files. It seems the Nagios XI VM does not include these files under either /usr/src or /usr/src/kernels.
The mechanism to install the files that I found (yum install kernel-devel) requires a link to the internet that the VM does not have.
Is there a way that I can download what is needed on another machine, put it on a USB drive that I can then attach to the VM, then run a similar command?
Thanks
Chris