Skip to content

peihaoY/DU-Moniter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DU-Moniter

Real-Time Sync Log Monitor

Overview

This repository contains two Python scripts used for PTP synchronization monitoring and resynchronization time testing with a commercial RU (Benetel) device connected at IP address 10.10.0.100.

Both scripts connect via SSH to the RU, monitor /var/log/pcm4l, and either visualize synchronization metrics in real-time or record recovery time under different configuration settings.


1. du_monitor.py

Purpose

Continuously monitor and visualize synchronization performance metrics (offset, delay, mean, std) in real time from the Benetel RU via SSH.

Connection Target

  • RU IP: 10.10.0.100
  • Log Source: /var/log/pcm4l

Output

  • Saves all parsed data to a CSV file named sync_log.csv.
  • Displays four live-updating plots:
    • Offset (ns)
    • Delay (ns)
    • Mean (ns)
    • Standard Deviation (ns)

How It Works

  1. Opens an SSH connection and runs:
    ssh root@10.10.0.100 tail -F /var/log/pcm4l
  2. Parses log lines containing either:
    offset: X ns delay: Y ns
    
    or
    mean: M ns, std: S ns
    
  3. Writes parsed values with timestamps into sync_log.csv.
  4. Plots real-time trends using matplotlib.

Usage

python3 du_monitor.py

Requirements

  • Python 3.7+
  • Installed libraries:
    pip install matplotlib

Output Example (Terminal)

[RECV] offset=-12.3 ns, delay=184.0 ns
[RECV] mean=0.2 ns, std=0.8 ns

2. sync_test.py

Purpose

Automatically test re-synchronization time after simulated sync loss, across different logSyncInterval values.

Connection Target

  • RU IP: 10.10.0.100
  • Log Source: /var/log/pcm4l

Configuration Paths

  • PTP_CONF = /home/inss/srs_scripts/ptp4l.conf
  • SCRIPT = /home/inss/srs_scripts/s0_ptp_run.sh
  • Output results saved to:
    /home/inss/peihao/resync_times.csv
    

How It Works

  1. Iterates through a list of logSyncInterval values: [-5, -4, -3, -2, -1, 0, 1, 2].
  2. For each interval:
    • Updates the logSyncInterval in ptp4l.conf.
    • Restarts the PTP service via s0_ptp_run.sh.
    • Monitors /var/log/pcm4l remotely through SSH.
  3. Detects sync loss (Lost master alarm raised) and recovery (offset: / delay:).
  4. Calculates and logs the resynchronization duration for each interval.
  5. Saves all results into resync_times.csv.

Usage

python3 sync_test.py

Requirements

  • Python 3.7+
  • SSH access to the RU at 10.10.0.100
  • Local read/write permission for the paths defined above

Output Example (Terminal)

[INFO] logSyncInterval set to -3
[INFO] Restarting PTP service...
[LOG] Lost master detected
[LOG] Recovered sync in 5.62 seconds
[DONE] Results saved to /home/inss/peihao/resync_times.csv

Notes

  • Both scripts assume passwordless SSH access to root@10.10.0.100. You can enable this using an SSH key:
    ssh-copy-id root@10.10.0.100
  • Ensure /var/log/pcm4l is being continuously written by the RU’s synchronization process.
  • The scripts are designed for Benetel commercial RU, but can be adapted for other devices by changing the SSH target and log parsing regex.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages