SUSE Linux Enterprise Server 11 Service Pack 2
SUSE Linux Enterprise Server 11 Service Pack 1
SLES
How to enabe ntp statistics
Error in ntp log
20 Mar 15:24:21 ntpd[11158]: can't open /ntpstats/peerstats.20120320: Permission denied
Edit the /etc/ntp/conf
unrem the following lines (remove #)
and add the statistics line
Create the /ntpstats directory at /var/lib/ntp/ntpstats" owned by "ntp". This directory can be a symbolic link to somewhere beneath /var/lib/ntp.
Example:
statistics loopstats peerstats clockstats
statsdir /ntpstats/ # directory for statistics files
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable
mkdir /var/lib/ntp/ntpstats
chown ntp:ntp /var/lib/ntp/ntpstats
If Apparmor is enabled set the ntp profile to complain
aa-complain places a profile into complain mode. aa-complain /etc/apparmor.d/usr.sbin.ntpd
or use YaST
If the ntp service needs to remain as enforce then in the /etc/apparmor.d/usr.sbin.ntpd make the ntpstats and files in the ntpstats rwl
/var/lib/ntp/ntpstats rwl,
/var/lib/ntp/ntpstats/loopstats* rwl,
/var/lib/ntp/ntpstats/peerstats* rwl,
ntpd is chrooted to /var/lib/ntp/
For the default configuration for SLES the chroot for ntp is /var/lib/ntp
To verify this do ps -ef | grep ntpd and look for the -c <conf file> which will point to the conf file. The directory path before the -c (conf file) is the chroot for ntpd
Example for output for this command
/usr/sbin/ntpd -p /var/run/ntp/ntpd.pid -g -u ntp:ntp -i /var/lib/ntp -c /etc/ntp.conf
Popular options are
- peerstats - Record peer statistics with one line appended to the peerstats file set each NTP packet or reference clock update
- loopstats - Record clock discipline loop statistics . One line is appended to the loopstats file set each system clock update
- clockstats - Record reference clock statistics with one line appended to the clockstats file set each update received from a reference clock driver
- sysstats - Record system statistics with one line appended to the sysstats file each hour
Example:
statistics loopstats peerstats clockstats sysstats
statsdir /ntpstats/ # directory for statistics files
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable
filegen sysstats file sysstats type day enable
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.