Skip to content

nic-monitor

nic-monitor observes send/receive rates and utilization on Linux physical NICs. During cross-node KV loading or network-storage access, it helps identify which NICs carry traffic, whether load is concentrated on one interface and whether utilization approaches link capacity.

Use it when:

  • Inspecting network load and traffic distribution during slow P/D transfers or remote-cache reads.
  • Recording NIC traffic during a load test to compare busy periods with increases in request latency.
  • Comparing send/receive rates across a multi-NIC deployment to identify uneven load.

Foreground mode displays live statistics; background mode saves CSV samples and interval reports that can also be visualized as charts. Statistics cover all traffic on each physical NIC, so use service metrics alongside them to attribute activity to UCM requests.

The script discovers physical NICs through /sys/class/net, reads vendor counters through ethtool first, and falls back to /proc/net/dev on failure.

← Back to UCM Toolkit

Dependencies

  • Linux, bash, ethtool, and root or sudo privileges to read NIC statistics.
  • NIC CSV offline plotting: pandas, matplotlib.

Because ethtool statistics access is required, root or sudo is typically needed:

sudo ucm-toolkit run nic-monitor fg

Foreground Mode

Foreground mode refreshes the terminal in real-time without writing to disk:

sudo ucm-toolkit run nic-monitor fg
sudo ucm-toolkit run nic-monitor fg 5

Parameters:

Parameter Default Description
fg [interval_sec] 2 Foreground refresh interval in seconds.

Press Ctrl+C to stop.

Background Mode

Background mode creates .log, .csv, and .pid files and continuously writes sampling data to CSV:

sudo ucm-toolkit run nic-monitor bg
sudo ucm-toolkit run nic-monitor bg 24 5
sudo ucm-toolkit run nic-monitor bg 24 5 --log-dir /mnt/test/net_log
sudo ucm-toolkit run nic-monitor bg 24 5 --log-dir /mnt/test/net_log --stat-cycle-seconds 600

Parameters:

Parameter Default Description
bg [duration_hours] [interval_sec] 12 10 Background run duration and sampling interval.
--log-dir PATH net_log in current working directory Output directory for logs, CSV, and PID files.
--stat-cycle-seconds SECONDS 3600 Phase statistics cycle in seconds.

Output filename format:

Eth_Perf_Monitor_YYYYmmdd_HHMMSS.log
Eth_Perf_Monitor_YYYYmmdd_HHMMSS.csv
Eth_Perf_Monitor_YYYYmmdd_HHMMSS.pid

On background start, it checks whether a live .pid process already exists in the same --log-dir to prevent duplicate launches.

NIC Result Visualization

toolkit/src/nic_monitor also provides two offline visualization entry points. They are not currently registered as ucm-toolkit run top-level tools.

Python Plotting

Install dependencies:

python -m pip install pandas matplotlib

Generate PNG charts:

python toolkit/src/nic_monitor/visualize_traffic.py net_log/Eth_Perf_Monitor_*.csv -o net_log/charts
python toolkit/src/nic_monitor/visualize_traffic.py net_log/Eth_Perf_Monitor_*.csv -o net_log/charts -i eth0 eth1

Parameters:

Parameter Default Description
csv *.csv in current directory Input CSV files, multiple allowed.
-o, --output . Image output directory.
-i, --interfaces All NICs Plot only specified NICs, multiple names allowed.

Each CSV generates a subdirectory with the same name, containing PNGs for traffic timeline, utilization timeline, total traffic stacked, and statistical summary.

Browser Page

Can be opened directly:

toolkit/src/nic_monitor/index.html

The page supports uploading or dragging CSV files generated by nic-monitor bg and viewing interactive charts in the browser.

FAQ

Permission Denied

Run with root or sudo:

sudo ucm-toolkit run nic-monitor fg
sudo ucm-toolkit run nic-monitor bg 12 10

Also confirm that ethtool is installed on the system.