Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
howtos:network_services:ntp [2013/03/01 16:36 (UTC)]
kikinovak Added a short explanation about problems with NFS and NIS when clients are out of sync
howtos:network_services:ntp [2014/02/17 21:13 (UTC)] (current)
kikinovak
Line 154: Line 154:
  
 <note tip>​Again,​ you might have to wait a few minutes before the first synchronization takes place.</​note>​ <note tip>​Again,​ you might have to wait a few minutes before the first synchronization takes place.</​note>​
 +  ​
 +===== Monitor the performance of ntpd =====
  
-=== Synchronizing at boot time ===+You will notice that the logfile ''/​var/​log/​ntp.log''​ does not contain any information about the actual accuracy of your system clock. If it's important to you, you can log the statistics of time corrections applied by NTP daemon to the system clock. To do this, add the following lines to ''/​etc/​ntp.conf'':​
  
-If instead of using a daemon, all you want to do is to synchronize time once per boot, it is possible to add the command ​''​ntpd ​-qg &''​ in the bottom ​of the file ''​/etc/rc.d/rc.local''​. This will synchronize ​the time once in the background ​and will exit and it needs ''​/​etc/​rc.d/​rc.ntpd'' ​to not be an executable+<​code>​ 
-   +statsdir /​var/​log/​ntp/​ 
-  ~# cat /etc/rc.d/rc.local +statistics loopstats 
-  #!/bin/sh +filegen loopstats file loops type day link enable 
-  # +</​code>​ 
-  # /etc/rc.d/rc.local: ​ Local system initialization script+ 
-  # +You have to create ​the statsdir manually. Once the configuration changes are in effect, ​''​ntpd''​ will create files named ''​loops.YYYYMMDD''​ in that directory. Below is an example line from one of these files: 
-  # Put any local startup commands in here.  Also, if you have +<​code>​ 
-  # anything that needs to be run at shutdown ​time you can +56690 3950.569 0.001199636 2.297 0.001830770 0.571576 10 
-  # make an /etc/rc.d/rc.local_shutdown script and put those +</​code>​ 
-  # commands ​in there. + 
-  ​+The first and second number are the UTC time (expressed as [[http://en.wikipedia.org/wiki/​Julian_day|Modified Julian Date]] and seconds elapsed since midnight)The third and fourth number are the offsets of time (in seconds) ​and of frequency (in parts per million). The fifth and sixth number are their respective uncertainties. 
-  . + 
-  . +To monitor the performance of ''​ntpd''​, you can examine the plot of clock offset or frequency offset vstime: 
-  ntpd -qg &+ 
 +<​code>​ 
 +$ awk '​{printf("​%f %f %f\n", $1+$2/86400, $3, $5)}' ​/var/log/​ntp/​loops.* > time 
 +$ awk '​{printf("​%f %f %f\n", $1+$2/86400, $4, $6)}' ​/var/log/ntp/loops.* > freq 
 +$ gnuplot 
 +gnuplot> set xzeroaxis 
 +gnuplot> plot 'time' with yerror 
 +gnuplot> plot '​freq'​ with yerror 
 +</code> 
 + 
 +Given enough data, visual examination of the plots will allow you to see peculiarities ​in ''​ntpd''​ performance,​ should they ariseFor example, in the case illustrated by the figure below, the rapid decrease of the frequency offset was caused by replacing the power supply unit of the machine
 + 
 +{{:​howtos:​network_services:​ntp_time_freq.png|}}
  
 ====== Sources ====== ====== Sources ======
  
   * Originally written by [[wiki:​user:​kikinovak|Niki Kovacs]]   * Originally written by [[wiki:​user:​kikinovak|Niki Kovacs]]
 +  * Performance monitoring section contributed by Dominik Drobek
  
 <!-- Please do not modify anything below, except adding new tags.--> <!-- Please do not modify anything below, except adding new tags.-->
 <!-- You must remove the tag-word "​template"​ below before saving your new page --> <!-- You must remove the tag-word "​template"​ below before saving your new page -->
 {{tag>​howtos time clock synchronization author_kikinovak}} {{tag>​howtos time clock synchronization author_kikinovak}}

In Other Languages
QR Code
QR Code howtos:network_services:ntp (generated for current page)