Network Monitor — monitor app

Network Monitor — monitor app

The Network Monitor is a Stage 2 monitor app: one 1024x768 window showing live traffic for the main network interface, built only from the LightGUI XFrame monitor widgets — no hand-rolled controls, no raw drawing for UI elements.

Network Monitor app (C build) showing live enp3s0 traffic

What it shows

Live traffic for the main interface (enp3s0 on hot_dallas, otherwise the first non-loopback interface with traffic), read from /proc/net/dev and differenced every 500 ms (C and Rust) or once a second (Python):

  • XNetGraph (top) — up/down graph in bytes/s, current rates plus session totals in the legend.
  • XSysBox (middle, x2) — Download / Upload big-number boxes in KiB/s, each with its own history sparkline and usage bar. The range tracks the session peak (x1.15, floor 100 KiB/s).
  • XHistoryGraph — down/up rate history in KiB/s over a 60 s window, with current / min / max / average per series.
  • XUsageBar (bottom) — total throughput as a percentage of the link speed, read from /sys/class/net/<iface>/speed (1 Gb/s fallback).

Live data, not demo data

The widgets preload seeded demo series. Each app flushes them at startup so everything on screen is measured traffic: the C app pushes the first measured rate 120x into XNetGraph (which has no clear API) and resets its totals, clears the history graph and re-seeds it with down/up series, and drives each XSysBox with 60 live values; the Rust app clears each widget's series before the first draw; the Python app pushes live samples, which start a fresh series instead of extending the demo.

Widgets used

  • XNetGraph — dual up/down scrolling network graph
  • XSysBox — title + big number + history graph + usage bar
  • XHistoryGraph — scrolling multi-series time-series graph
  • XUsageBar — gradient usage bar

Build and run

C

cd lightgui/examples/monitor/network-monitor
make
./network-monitor   # quit with q, Escape, or window close

Rust

bash -lc "cargo run -p xframe-demo --example monitor_network_monitor"
# quit with q, Escape, or window close

Python

PYTHONPATH=. python3 examples/monitor_network_monitor/main.py
# quit by closing the window

Python tests stay green: DISPLAY=:99 python3 -m unittest discover -s tests — 363 tests, OK.

Source

Repos: lightgui (C) · lightgui_rust (Rust) · lightgui_python (Python)

Linux Rocks Every Day
Source code: LightGUI (C) · LightGUI (Rust) · LightGUI (Python)