A beautiful, real-time CLI tool for monitoring network latency over configurable time windows. Track ping statistics with live updates, color-coded metrics, and sliding window analytics.
- 📊 Sliding Window Statistics — Track metrics across multiple configurable time periods (10s, 1m, 5m, 1h, etc.)
- 🎨 Live Color-Coded Display — Green for healthy, yellow for moderate, red for critical latency/loss
- ⚡ Real-Time Updates — In-place refresh shows evolving stats as old pings age out of each window
- 🔒 No Root Required — Uses unprivileged ICMP sockets (works on most modern Linux systems)
- 📈 Comprehensive Metrics — Min/Max/Avg RTT, packet loss percentage, and network jitter
- ⌨️ Simple & Intuitive — Clean interface, sensible defaults, easy to customize
# Clone the repository
git clone https://github.com/yourusername/ltping.git
cd ltping
# Make it executable
chmod +x ltping.py
# Run with default settings (10s / 30s / 60s windows)
python3 ltping.py google.com- Python 3.10 or newer
- Linux with kernel support for unprivileged ICMP sockets
Most modern Linux distributions allow unprivileged ping sockets by default. If you see a "ping_group_range" error on first run, fix it with:
sudo sysctl -w net.ipv4.ping_group_range='0 2147483647'To make this permanent across reboots:
echo 'net.ipv4.ping_group_range = 0 2147483647' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p# Default: monitor with 10s, 30s, and 60s windows
python3 ltping.py google.com
# Ping an IP address
python3 ltping.py 8.8.8.8
# Custom time windows
python3 ltping.py example.com -w 5s 15s 60s 5m
# Fast ping interval (500ms between pings)
python3 ltping.py 1.1.1.1 -i 0.5
# Long-term monitoring with multiple windows
python3 ltping.py example.com -w 10s 1m 5m 30m 1hltping [-h] [-w WINDOWS [WINDOWS ...]] [-i INTERVAL] [-t TIMEOUT] [--no-color] target
Positional arguments:
target Hostname or IP address to ping
Options:
-h, --help Show help message and exit
-w, --windows Time windows (e.g. 10s 30s 60s 5m 1h)
Default: 10s 30s 60s
-i, --interval Seconds between pings (default: 1.0)
-t, --timeout Seconds to wait for each reply (default: 2.0)
--no-color Disable colored output
Time windows can be specified in seconds (s), minutes (m), or hours (h):
10s— 10 seconds5m— 5 minutes (300 seconds)1h— 1 hour (3600 seconds)30— Plain numbers are treated as seconds
ltping google.com (142.250.80.46) seq=42 last=15.3 ms lifetime 42/42 (100.0%)
────────────────────────────────────────────────────────────────────────
Window Sent Rcvd Loss Min Max Avg Jitter
────────────────────────────────────────────────────────────────────────
10s 10 10 0.0% 12 ms 18 ms 15 ms 2.1 ms
30s 30 30 0.0% 12 ms 20 ms 15 ms 2.3 ms
60s 60 59 1.7% 12 ms 25 ms 16 ms 3.1 ms
────────────────────────────────────────────────────────────────────────
Press Ctrl+C to stop.
- Window — Time period for the rolling statistics
- Sent — Total pings sent in this window
- Rcvd — Pings that received a reply
- Loss — Packet loss percentage (color-coded: green = 0%, yellow < 10%, red ≥ 10%)
- Min/Max/Avg — Round-trip time statistics in milliseconds
- Jitter — Average variation between consecutive RTTs (lower is better)
Packet Loss:
- 🟢 Green: 0% loss
- 🟡 Yellow: < 10% loss
- 🟠 Orange: < 50% loss
- 🔴 Red: ≥ 50% loss
Latency (RTT):
- 🟢 Bright Green: < 20ms (excellent)
- 🔵 Cyan: 20-100ms (good)
- 🟡 Yellow: 100-300ms (moderate)
- 🔴 Red: > 300ms (high)
Jitter:
- 🟢 Green: Low variance (< 20% of average RTT)
- 🟡 Yellow: Moderate (20-50% of average)
- 🔴 Red: High variance (> 50% of average)
Monitor intermittent connectivity issues over extended periods:
python3 ltping.py gateway.local -w 1m 5m 15m 1hTrack your internet connection quality throughout the day:
python3 ltping.py 8.8.8.8 -w 5m 30m 1h 6h -i 2Measure response time to a remote service with high-frequency pings:
python3 ltping.py api.example.com -i 0.2 -w 10s 30s 60sCompare latency before and after VPN connection:
python3 ltping.py cloudflare.com -w 30s 2m 5mSliding Windows: Each time window maintains a queue of recent ping results. As new pings arrive, old ones beyond the window duration are automatically dropped. This gives you real-time insight into recent network behavior.
Unprivileged ICMP: Uses SOCK_DGRAM with IPPROTO_ICMP — the Linux kernel's ping socket API. No raw sockets required, so no root privileges needed on most systems.
Jitter Calculation: Computed as the average of absolute differences between consecutive RTTs within each window. This helps identify network instability beyond simple packet loss.
Your kernel's ping_group_range is restricted. Fix with:
sudo sysctl -w net.ipv4.ping_group_range='0 2147483647'Or run with sudo as a one-time workaround:
sudo python3 ltping.py example.comIf you're piping output or using a non-TTY terminal, colors are automatically disabled. You can force disable with --no-color:
python3 ltping.py example.com --no-color > log.txtBy default, ltping pings once per second. If you've set a very short interval (e.g., -i 0.01), it may consume more CPU. For most monitoring scenarios, 0.2-1.0 second intervals are sufficient.
- Language: Python 3.10+
- Dependencies: Standard library only (no pip packages required)
- Protocol: ICMP Echo Request/Reply (RFC 792)
- Socket Type:
AF_INET,SOCK_DGRAM,IPPROTO_ICMP - Platform: Linux (kernel 2.6.39+)
- IPv4 only — IPv6 support is not currently implemented
- Linux only — Uses Linux-specific ping socket API (won't work on macOS/Windows without modification)
- Single target — Monitors one host at a time (run multiple instances for parallel monitoring)
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
MIT License — see LICENSE file for details.
- Inspired by traditional
pingand network monitoring tools - Built with a focus on real-time visualization and user experience
ping— The original ICMP echo utilitymtr— Network diagnostic tool combining ping and tracerouteiperf— Network bandwidth measurement tool
Made with ❤️ for network engineers, sysadmins, and anyone who needs to know if their internet is actually working.