Operations 10 min read

Why Dish Beats Netstat: A Lightweight Socket Monitoring CLI

This article introduces Dish, a Go‑based command‑line utility for real‑time socket connection monitoring, explains its core features, technical principles, installation and usage examples, compares it with tools like netcat, nmap and telnet, and discusses its advantages and limitations for operations teams.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Why Dish Beats Netstat: A Lightweight Socket Monitoring CLI

Overview

Dish is a lightweight command‑line tool written in Go for monitoring socket connection states. It can be invoked manually or scheduled with cron to perform one‑off health checks without a persistent daemon.

Core Capabilities

Connection success : verifies that a target host and port are reachable (e.g., HTTP port 80).

Abnormal disconnect : detects connection‑refused, timeout or reset (RST) conditions.

Stale connections : reports half‑open states such as TIME_WAIT and CLOSE_WAIT.

Protocol Support

Dish works with IPv4 and IPv6 and supports both TCP and UDP, making it suitable for typical services such as web servers, databases, and DNS resolvers.

Advantages

Lightweight : no external libraries, minimal CPU and memory footprint.

Simple & efficient : focuses on single‑shot socket checks rather than continuous traffic generation.

Flexible deployment : can be run on multiple hosts, fetch socket lists from a public API, and send results to various notification channels (Telegram, Pushgateway, plain text).

Technical Principles

Dish simulates a client connection to the target endpoint. For TCP it performs the three‑way handshake; for UDP it sends a single packet and waits for a response. The tool parses the network response to classify the outcome as SUCCESS, REFUSED, TIMEOUT, or RST. An optional state‑machine model tracks intermediate states such as SYN_SENT, FIN_WAIT, and TIME_WAIT. Configurable timeout and retry parameters reduce false negatives while keeping overhead low.

Typical Use Cases

Service availability monitoring – replaces telnet or nc for batch port checks.

Fault isolation – quickly identify network interruptions, service crashes, or firewall rule misconfigurations.

Automated operations – integrate into CI/CD pipelines as a post‑deployment health check.

Installation & Usage

Dish can be installed via the Go toolchain or Homebrew:

go install go.vxn.dev/dish/cmd/dish@latest
brew install dish

Run Dish with a local JSON file that lists sockets to test: dish /opt/dish/sockets.json Or provide a remote API endpoint that returns the same JSON structure:

dish http://restapi.example.com/dish/sockets/:instance

Common flags (selected examples): -timeout uint: connection timeout in seconds (default 10). -cache: cache the remote socket list. -cacheDir string: directory for cached data (default “.cache”). -cacheTTL uint: cache validity in minutes (default 10). -target string: URL or path to push results (e.g., Pushgateway endpoint). -telegramBotToken string and -telegramChatID string: send a notification via Telegram. -verbose: enable console logging.

General syntax: dish [FLAGS] SOURCE Example – check TCP port 80 on example.com:

dish --host example.com --port 80 --protocol tcp

Example – UDP DNS query with a 2‑second timeout:

dish --host 8.8.8.8 --port 53 --protocol udp --timeout 2

Limitations

No built‑in historical data storage; long‑term trend analysis requires external systems such as Prometheus + Grafana.

Only checks transport‑layer connectivity; it does not perform HTTPS or other application‑layer validation.

Conclusion

Dish provides a focused, low‑overhead solution for diagnosing socket connectivity issues. Its strength lies in fast, precise detection of reachable, refused, timed‑out, or half‑open connections. For comprehensive observability, combine Dish with a time‑series database or monitoring stack.

Repository: https://github.com/thevxn/dish

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

OperationsGoCLI toolsocket monitoring
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.