Wednesday 3 July 2013

servers time going out of sync

I had an issue where a monitoring slave went out of sync with the master.

Quick fix - set the date/time manually
date MMddhhmmyyyy” so 17:32 13/12/2012 would be “date 121317322012”. You need to be root to run this command so “sudo su” or “sudo bash” first.
Or restart ntpd

You should have an NTP server configured in your network. FYI you can configure a Cisco ASA to provide NTP. The NTP server should be syncing off a local ntp server see http://www.pool.ntp.org/en/.

Some troubleshooting / information gathering steps below:

Step 1 - log on to both servers (the out of sync and the in sync)
Run "watch -n 1 date" this should highlight the difference in time

Step 2 - is the server VM or physical
sudo /usr/sbin/dmidecode | grep "Manufacturer: \|Product Name: "
If its a VM check for the vmware or hyper-v tools check time sync settings there
Check time sync settings on the VM host
If physical check ntp settings

Step 3 - check ntp config
vi /etc/ntp.conf 

Step 4 - check scheduled tasks, is ntpdate or ntpd running
sudo bash
crontab -l
*/1 * * * * /usr/bin/ntpd -q ?
This runs ntpd with –q which quits after it has set the time the “ > /dev/null” just redirects any output to trash because we don’t want to see the output. The 2>&1 is used to redirect stderr to stdout.  /dev/null 2>&1
ntpdate and ntpd are different and you shouldn't have both running at the same time

Step 5 - check service startup settings
/sbin/chkconfig –list

Step 6 - check ntpd service status
/etc/init.d/ntpd status


No comments:

Post a Comment