Scripts2026年4月14日·1 分钟阅读

gping — Ping with a Real-Time Terminal Graph

gping replaces `ping` with a terminal graph showing latency over time. Watch packet loss spikes and jitter visually, ping multiple targets side by side, and finally understand what your network is doing.

Introduction

gping takes the classic ping command and adds a live scrolling graph in the terminal. Each ping response plots as a point; latency spikes become obvious; packet loss shows as gaps. For anyone debugging network issues — ISP problems, Wi-Fi jitter, VPN overhead — the graph tells you in 10 seconds what a column of numbers takes minutes to convey.

With over 12,000 GitHub stars, gping is a must-have for network engineers, sysadmins, and anyone who's ever yelled at an unreliable Wi-Fi signal.

What gping Does

gping pings one or more targets at a fixed interval, renders a sliding-window graph on stdout using Unicode/ANSI drawing, and shows running stats (min/avg/max/jitter). The --cmd mode runs an arbitrary command periodically and graphs its runtime — useful for "how stable is this curl request?" scenarios.

Architecture Overview

[gping (Rust)]
      |
[Pinger]
   sends ICMP (needs raw socket perms) or TCP handshake
   parallel per target, 1s interval (configurable)
      |
[Buffer]
   ring buffer of (timestamp, latency) tuples
      |
[Graph Renderer]
   crossterm + tui-rs
   overlaid lines per target, colored
   auto-scaling Y axis
      |
[Stats panel]
   min / avg / max / jitter / loss per target

Self-Hosting & Configuration

# Useful flags
gping -n 10 host.example.com           # ping every 10s
gping --buffer 600 google.com          # widen X axis to 10 min
gping -4 google.com                    # IPv4 only
gping -6 google.com                    # IPv6 only

# TCP-mode (uses TCP handshakes instead of ICMP)
# Helpful when ICMP is filtered by firewalls
gping --tcp github.com:443

# Compare network + endpoint latency
gping --cmd "curl -s https://api.example.com/health -o /dev/null" \
      --cmd "curl -s https://api-backup.example.com/health -o /dev/null"

# Show historical stats when quitting
# Press q to quit; summary prints

Key Features

  • Real-time terminal graph — Unicode-drawn sliding window
  • Multi-target overlay — compare several endpoints simultaneously
  • TCP mode — works where ICMP is filtered
  • Command mode — graph any command's runtime, not just ping
  • Auto-scaling axis — zooms Y axis to fit latest values
  • Jitter + loss stats — real-time summary alongside the graph
  • Cross-platform — Rust binary on macOS, Linux, Windows
  • Color-coded per target — distinguish overlays at a glance

Comparison with Similar Tools

Feature gping mtr prettyping ping iperf3
Graph Yes No Yes (simpler) No No
Multi-target overlay Yes No No No No
TCP mode Yes Yes (via mtr-tcp) No No Yes (focused)
Command mode Yes No No No No
Best For Visual latency trending Hop-by-hop path debugging Prettier single-target ping Baseline universal Throughput test

FAQ

Q: Why not just use mtr? A: mtr shows hop-by-hop latency (useful for "where is the problem?"). gping shows end-to-end latency over time (useful for "when is it slow?"). Different questions; use both.

Q: Does gping need root? A: ICMP mode usually yes (raw sockets). On Linux, set capability setcap cap_net_raw+ep $(which gping) once. TCP mode (--tcp) works without privileges.

Q: Can I use it in tmux or screenshots? A: Yes — the Unicode output looks fine in any modern terminal. It's a popular share-a-screenshot-on-Twitter tool when debugging ISP issues.

Q: Does it log to a file? A: Not directly. For historical data, pair with a monitoring tool (Smokeping, Prometheus blackbox exporter) — gping is for interactive debugging.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产