Monitor NTP & Chrony Time Sync on Linux Servers
Time Synchronization Monitoring - NTP and Chrony Best Practices
Time synchronization monitoring is essential for ensuring accurate system time across servers, which is critical for log correlation, security, and application functionality. This comprehensive guide covers everything you need to know about monitoring NTP and Chrony time synchronization.
For checking NTP status, see Check NTP Time Synchronization Status. For monitoring system time, see Monitor System Date Timezone.
Why Time Synchronization Monitoring Matters
Accurate time synchronization is critical for log correlation, security certificate validation, database replication, and distributed systems. Time drift can cause authentication failures, log analysis issues, and application errors.
Effective time synchronization monitoring enables you to:
- Track time accuracy and drift
- Monitor NTP server status
- Detect time synchronization failures
- Ensure reliable time synchronization
- Maintain accurate system time
- Prevent time-related issues
Key Time Synchronization Metrics to Monitor
Accuracy Metrics
- Time Offset: Difference between system time and NTP server time
- Time Drift: Rate of time drift over time
- Jitter: Variation in time offset
- Stratum: NTP server stratum level
Status Metrics
- NTP Service Status: NTP daemon running status
- NTP Server Reachability: Ability to reach NTP servers
- Synchronization Status: Whether system is synchronized
- Last Sync Time: Time of last successful synchronization
Method 1: Monitor NTP Status
Check NTP Synchronization Status
# Check NTP status
ntpq -p
# Check NTP peer status
ntpq -pn
# Get NTP statistics
ntpstat
# Check if system is synchronized
ntpstat && echo "Synchronized" || echo "Not synchronized"
Monitor NTP Time Offset
# Check time offset
ntpq -c "rv 0 offset"
# Get detailed NTP information
ntpq -c "rv 0"
# Check time difference
ntpdate -q pool.ntp.org
Check NTP Service Status
# Check NTP service status
systemctl status ntp
# Check if NTP is running
systemctl is-active ntp
# View NTP logs
journalctl -u ntp -n 50
Method 2: Monitor Chrony Status
Check Chrony Synchronization Status
# Check Chrony sources
chronyc sources
# Check Chrony tracking
chronyc tracking
# Get Chrony statistics
chronyc sourcestats
# Check if system is synchronized
chronyc tracking | grep "Leap status"
Monitor Chrony Time Accuracy
# Check time offset
chronyc tracking | grep "Last offset"
# Get system time accuracy
chronyc tracking | grep "System time"
# Check Chrony server status
chronyc activity
Check Chrony Service Status
# Check Chrony service status
systemctl status chronyd
# Check if Chrony is running
systemctl is-active chronyd
# View Chrony logs
journalctl -u chronyd -n 50
Method 3: Automated Time Synchronization Monitoring with Zuzia.app
Manual checks work while you are looking. To keep running them without you, Zuzia uses its agent and scheduled tasks.
How it works in Zuzia
- Install the Zuzia agent on the server with one command. CPU, RAM, disk, load and network metrics start reporting on their own, with alerts on a threshold, on drift from the server's normal, or on a disk fill-up forecast.
- Save the commands from this guide as a scheduled task and choose how often it runs, from every minute to once a year. The agent runs it on every host you pick.
- If a command fails, you get an alert right away by email, Slack, Discord, push (through your Pushover account) or SMS (through your Vonage account).
- The output of every run is kept, so you can look back at what changed. On paid plans, AI can read the output and alert you only when it spots a problem.
Setting it up
- Add the server in the Zuzia dashboard and install the agent.
- Create a scheduled task with the check commands below, then choose the hosts and how often it runs.
- Choose your notification channels. Turn on maintenance mode during planned work so it doesn't trigger alerts.
Best Practices for Time Synchronization Monitoring
1. Monitor Time Accuracy Continuously
- Track time offset regularly
- Alert when time drift exceeds thresholds
- Monitor time synchronization status
- Verify time accuracy across servers
2. Monitor NTP/Chrony Service Status
- Track service running status
- Monitor service availability
- Check service logs for errors
- Alert on service failures
3. Use Multiple NTP Servers
- Configure multiple NTP servers
- Monitor NTP server reachability
- Ensure redundant time sources
- Test NTP server responses
4. Set Up Comprehensive Alerts
- Configure alerts for time drift
- Set up alerts for service failures
- Monitor synchronization status
- Alert on time accuracy issues
5. Verify Time Synchronization Across Servers
- Compare time across servers
- Ensure consistent time synchronization
- Monitor time differences between servers
- Verify log timestamps are consistent
Troubleshooting Time Synchronization Issues
Step 1: Identify Time Synchronization Problems
When time synchronization fails:
Check NTP/Chrony Status:
- Review service status
- Check synchronization status
- Verify NTP server connectivity
Monitor Time Offset:
- Check current time offset
- Review time drift trends
- Identify time accuracy issues
Review Service Logs:
- Check NTP/Chrony logs
- Identify error patterns
- Review synchronization attempts
Step 2: Resolve Time Synchronization Issues
Based on investigation:
Fix NTP/Chrony Service:
- Restart NTP/Chrony service
- Fix service configuration
- Resolve network connectivity issues
Optimize Time Synchronization:
- Configure multiple NTP servers
- Adjust synchronization settings
- Optimize NTP server selection
Fix Time Accuracy:
- Manually sync time if needed
- Adjust system clock
- Verify NTP server accuracy
FAQ: Common Questions About Time Synchronization Monitoring
How often should I check time synchronization?
For production servers, continuous automated monitoring is essential. Zuzia.app can check time synchronization every few minutes, storing historical data and alerting you when time drift exceeds thresholds.
What is considered acceptable time drift?
Acceptable time drift depends on your requirements. Generally, time drift under 100ms is excellent, 100ms-1s is acceptable, and over 1s requires attention. Set thresholds based on your application requirements.
How do I monitor time synchronization across multiple servers?
Zuzia.app allows you to monitor time synchronization across multiple servers from one centralized dashboard. Compare time offsets across servers to ensure consistent time synchronization.
Can time synchronization monitoring impact performance?
Time synchronization monitoring commands have minimal impact on server performance. Use appropriate monitoring frequency and ensure NTP/Chrony services are properly configured.
Related guides, recipes, and problems
Related guides
guides--server-performance-monitoring-best-practices.mdguides--monitoring-application-performance-linux.md
Related recipes
recipes--check-ntp-time-synchronization-status.mdrecipes--monitor-system-date-timezone-linux.mdrecipes--monitor-system-date-time-linux.md
Related problems
problems--service-not-running-linux.md