main
rtnetmon
Real-time network monitoring dashboard for Linux systems with dual-interface support.
Overview
rtnetmon is a terminal-based network monitoring tool that provides real-time visibility into network health, packet loss, and latency across two network interfaces simultaneously. It's designed for Linux systems and uses ncurses for a clean, real-time dashboard interface.
Features
- Dual Interface Monitoring: Monitor two network interfaces simultaneously
- Real-time Updates: Live dashboard with sub-second updates
- Comprehensive Metrics:
- ICMP reachability tests
- Packet loss percentage
- TCP connection latency
- Interface health status
- Visual Indicators: Color-coded status, spinners, and meters for quick status assessment
- Packet loss meter uses reverse coloring (empty/green = good, full/red = bad)
- Detailed Logging: Optional logging to file for debugging and analysis
Requirements
- Linux operating system
- Go 1.21 or later
- Root/sudo access (for raw ICMP packets)
pingcommand available in PATH
Installation
git clone https://git.eeqj.de/sneak/rtnetmon.git
cd rtnetmon
make build
Usage
sudo ./rtnetmon --ifaceA eth0 --labelA "Primary WAN" --ifaceB wlan0 --labelB "Backup WiFi"
Command Line Options
--ifaceA: Primary network interface (default: "gu0")--labelA: Label for primary interface (default: "gu LAN - VPN outbound")--ifaceB: Secondary network interface (default: "backhaul0")--labelB: Label for secondary interface (default: "Cox cable direct")--hosts: Comma-separated list of hosts to monitor--logfile: Path to log file (default: "/tmp/rtnetmon.log")
Keyboard Controls
qorCtrl+C: Quit the application
Project Structure
rtnetmon/
├── cmd/rtnetmon/ # Main entry point
│ └── main.go
├── internal/
│ ├── cli/ # Command-line interface using Cobra
│ │ └── root.go
│ └── monitor/ # Core monitoring functionality
│ ├── monitor.go # Main monitoring types and functions
│ ├── loops.go # Monitoring loops (reachability, loss, TCP)
│ ├── styles.go # Terminal color styles
│ └── ui.go # User interface rendering
├── go.mod
├── go.sum
├── Makefile
└── README.md
Development
Building
make build # Build the binary
make test # Run tests
make lint # Run linter
make fmt # Format code
make all # Format, lint, test, and build
Testing
The project includes unit tests for core functionality. Run tests with:
make test
Using the Monitor API
The monitor package provides an object-oriented API for programmatic use:
import "git.eeqj.de/sneak/rtnetmon/internal/monitor"
// Create a new monitor
mon := monitor.NewMonitor("eth0", "Primary", "wlan0", "Backup", "/tmp/monitor.log")
// Configure timing parameters (optional - defaults are sensible)
mon.ICMPTimeout = 1 * time.Second
mon.PacketLossPings = 10
mon.PacketLossPeriod = 10 * time.Second
// Add hosts to monitor
mon.AddReachabilityHost("8.8.8.8")
mon.AddReachabilityHost("google.com")
mon.AddPacketLossHost("github.com")
mon.AddPacketLossHost("8.8.8.8")
mon.AddTCPHost("google.com:443")
mon.AddTCPHost("github.com:443")
// Run the monitor
ctx := context.Background()
if err := mon.Run(ctx); err != nil {
log.Fatal(err)
}
License
WTFPL - Do What The Fuck You Want To Public License
Author
Languages
Go
98.1%
Makefile
1.9%