Features: - Multiple probe methods: ICMP (subprocess), TCP connect, HTTP/HTTPS - No root required - SQLite storage for measurements - Beautiful terminal graphs with plotext - Single-file script with PEP 723 inline dependencies - CLI interface with rich output Commands: add, remove, list, enable, disable, probe, run, stats, graph, history, import-config Run with: uv run yaping.py
yaping - Yet Another PING
A SmokePing-like network latency monitoring tool written in Python with CLI graphs.
Features
- Multiple Probe Methods: ICMP (via subprocess), TCP connect, HTTP/HTTPS timing
- No Root Required: Uses system ping command or pure-Python TCP/HTTP probes
- SQLite Storage: Persistent storage of all measurements
- Terminal Graphs: Rich CLI visualization using plotext
- Single-file Script: Uses PEP 723 inline dependencies with
uv run
Requirements
- Python 3.11+
- uv package manager
Installation
No installation required! Just run with uv:
# Clone or download yaping.py
uv run yaping.py --help
uv automatically installs dependencies on first run.
Quick Start
# Add targets
uv run yaping.py add google --host google.com
uv run yaping.py add cloudflare --host 1.1.1.1 --method tcp --port 443
uv run yaping.py add github --host https://api.github.com --method http
# List targets
uv run yaping.py list
# Run single probe
uv run yaping.py probe
# Start continuous monitoring
uv run yaping.py run
# View statistics
uv run yaping.py stats
# Display graph
uv run yaping.py graph google
uv run yaping.py graph # All targets
Commands
| Command | Description |
|---|---|
add NAME --host HOST |
Add a monitoring target |
remove NAME |
Remove a target |
list |
List all targets |
enable NAME |
Enable a target |
disable NAME |
Disable a target |
probe |
Run single probe for all targets |
run |
Run continuous monitoring |
stats [NAME] |
Show latency statistics |
graph [NAME] |
Display terminal graph |
history NAME |
Show measurement history |
import-config FILE |
Import targets from TOML config |
Probe Methods
ICMP (default)
uv run yaping.py add myserver --host example.com
TCP Connect
uv run yaping.py add dns --host 1.1.1.1 --method tcp --port 53
uv run yaping.py add https --host example.com --method tcp --port 443
HTTP/HTTPS
uv run yaping.py add api --host https://api.example.com --method http
Example Output
Statistics
Statistics (last 1h)
┏━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━┳━━━━━━━━━┓
┃ Target ┃ Avg ┃ Min ┃ Max ┃ StdDev ┃ Loss ┃ Samples ┃
┡━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━╇━━━━━━━━━┩
│ cloudflare │ 3.4ms │ 3.3ms │ 3.5ms │ 0.2ms │ 0.0% │ 2 │
│ google │ 4.1ms │ 4.1ms │ 4.2ms │ 0.1ms │ 0.0% │ 2 │
└────────────┴───────┴───────┴───────┴────────┴──────┴─────────┘
Graph
Latency - google (last 1h)
┌───────────────────────────────────────────────────────────────────────────┐
4.20┤ ⢀⠤⠊⠒⠒⠢⠤⠤⣀⣀⡀ │
4.10┤⣀⠤⠊⠁ ⠈⠉⠉⠒⠒⠢⠤⠤⣀⣀⡀ │
│ ⠈⠉⠉⠒⠒⠢⠤⠤⣀⣀⡀ │
4.00┤ ⠈⠉⠉⠒⠒⠒⠤⠤⢄⣀⣀ │
3.90├────────────────────────────────────────────⠉⠉⠑⠒⠒⠤⠤⢄⣀⣀─────────────────────┤
3.80┤ ⠉⠉⠑⠒⠒⠤⠤⢄⣀⣀ ⢸│
└┬──────────────────┬─────────────────┬──────────────────┬─────────────────┬┘
Statistics: avg=3.9ms, min=3.6ms, max=4.2ms, loss=0.0%
Configuration File
Import targets from a TOML configuration file:
# yaping.toml
[[targets]]
name = "google-dns"
host = "8.8.8.8"
method = "icmp"
interval = 30
[[targets]]
name = "cloudflare"
host = "1.1.1.1"
method = "tcp"
port = 443
interval = 60
uv run yaping.py import-config yaping.toml
Options
Global Options
--db PATH: Custom database path (default:~/.local/share/yaping/yaping.db)
Time Periods
Use with stats, graph, and history:
-p 1h: Last hour (default)-p 24h: Last 24 hours-p 7d: Last 7 days
Running Tests
uv run --script test_yaping.py
Dependencies
All handled automatically by uv:
- click - CLI framework
- httpx - HTTP/HTTPS probing
- plotext - Terminal graphs
- rich - Beautiful terminal output
License
MIT
Description
Languages
Python
100%