A premium, cross-platform, production-grade written in pure Python 3. Zero external dependencies. High-concurrency diagnostics, structured output (JSON/CSV/XML), watch/loop mode, shell completions, man page, and an integrated for AI assistants.
Comprehensive cross-platform network diagnostics CLI & MCP server (TCP, DNS, HTTP, SSL, Traceroute, Port Scan).
Yıldızlar
3
Araçlar
—
Çalışma süresi
—
Network Intelligence Engine & CLI
Model Context Protocol (MCP) Server
🚀 Key Features
Zero-Dependency Core — Built entirely on the Python standard library. No pip install needed to run.
Cross-Platform — Native support for Linux, macOS, and Windows with consistent terminal output.
HTTP method: GET (default), HEAD, POST, PUT, DELETE, PATCH
-H, --header
Custom header Key: Value (repeatable)
--auth
Basic auth user:pass
Interfaces / Public IP Options
netcheck interfaces # Show active interfaces only
netcheck interfaces --all # Show all interfaces (including inactive)
netcheck interfaces --public # Also fetch and display public WAN IP
netcheck --my-ip --public # Legacy flag with public IP
The installer script (packaging/linux/install.sh) does all of this automatically.
⚙️ Alerting, Config & Prometheus (serve)
NetCheck features a robust, zero-dependency configuration, alerting, and Prometheus metrics engine.
1. Configuration Manager
Configure SMTP, Slack, Webhooks, and default check timeouts safely:
netcheck config init # Run interactive wizard to generate config
netcheck config show # Print current configuration + OS keychain status
netcheck config path # Print path to config.yaml file
netcheck config edit # Open config.yaml in your local $EDITOR
netcheck config purge # Delete config.yaml AND wipe all keychain secrets
Credential Safety (System Keychain):
All sensitive credentials are stored in the OS credential manager (Keychain on macOS, Credential Manager on Windows, GNOME Keyring/KWallet on Linux). config.yaml never stores secrets.
netcheck config test-alert email # Send a real test email now
netcheck config test-alert slack # Post a test Slack message now
netcheck config test-alert desktop # Trigger a test desktop notification
netcheck config test-alert webhook # POST a test webhook payload
2. Alerting Engine
Trigger alerts on state changes (UP ⇄ DOWN transition) during watch or serve loops. This prevents alert storms from repeated failures.
Supported channels:
SMTP Email — STARTTLS with Gmail App Password support; OS keychain credential lookup
Slack — incoming webhook URL stored securely in OS keychain
Generic Webhook — JSON POST with Bearer token stored in keychain and {target} template substitution
# Alert via email and Slack on any TCP state change
netcheck tcp api.example.com 443 -w --alert email,slack
# Only alert when a target goes DOWN (suppress UP/recovery alerts)
netcheck tcp api.example.com 443 -w --alert slack --alert-on down
# Alert on recovery only, via desktop notification
netcheck http https://api.example.com -w --alert desktop --alert-on up
# Alert via desktop notifications on DNS changes, 5-minute cooldown
netcheck dns google.com -w --alert desktop --alert-cooldown 300
🧪 How to Test Alerts Locally
Run the interactive config wizard and configure your alerting channels (e.g., Slack Webhook or Desktop):
netcheck config init
In Terminal A, start watching a local port with alerts enabled:
Simulate a service going DOWN by killing the listener in Terminal B (Ctrl+C or $listener.Stop()).
NetCheck will detect the state change and immediately trigger a DOWN alert to Slack and Desktop:
❌ Alert: localhost:9999 is DOWN (Connection refused)
Restart the listener in Terminal B. NetCheck will detect the recovery and emit a RECOVERED alert:
✅ Alert: localhost:9999 is back UP
3. Prometheus Metrics Exporter (serve mode)
Run netcheck as a background daemon monitoring multiple targets and serving /metrics in the Prometheus text exposition format.
# Monitor hosts from a file and serve metrics on port 9090
netcheck serve --metrics --port 9090 hosts.txt
All subcommands produce machine-readable structured JSON output when -f json is set. Use this to build health-gate scripts, monitoring alerts, or GitHub Actions checks:
# Check if a TCP port is open — fail the step if not
netcheck tcp prod.example.com 443 -f json | python3 -c \
"import sys, json; d=json.load(sys.stdin); sys.exit(0 if d['results'][0]['status']=='success' else 1)"
# Extract DNS IPs with jq
netcheck dns api.example.com -f json | jq '.ips[]'
# List open ports as JSON array
netcheck scan 192.168.1.1 --ports 1-1024 -f json | jq '.open_ports[] | {port, service}'
# Get SSL days-until-expiry, alert if < 30
netcheck ssl prod.example.com -f json | jq -e '.days_until_expiry > 30'
# Traceroute hop count for latency monitoring
netcheck traceroute 8.8.8.8 -f json | jq '.hops | length'
# Listening ports as CSV for spreadsheet import
netcheck ports -f csv > listening_ports.csv
# Use NO_COLOR to suppress ANSI in logs
NO_COLOR=1 netcheck tcp prod.example.com 443
# Override timeout and workers for fast CI checks
NETCHECK_TIMEOUT=3 NETCHECK_MAX_WORKERS=50 netcheck scan 10.0.0.1 --ports 80,443,8080 -f json
Exit Codes
Code
Meaning
0
All checks succeeded
1
One or more checks failed
2
Argument / usage error
🧪 Running Tests
# Using Make
make test
# Using pytest directly
PYTHONPATH=. python3 -m pytest tests/ -v
# With coverage
PYTHONPATH=. python3 -m pytest tests/ --cov=netcheck --cov-report=term-missing
NetCheck adheres to deterministic, script-friendly POSIX exit code conventions:
Exit Code
Constant
Meaning
0
EXIT_OK
All network checks passed successfully
1
EXIT_FAIL
One or more checks failed or targets were unreachable
2
EXIT_BAD_ARGS
Invalid arguments, unsupported flags, or empty target list
3
EXIT_ERROR
Unexpected runtime error
130
EXIT_INTERRUPT
Interrupted by user via Ctrl+C / SIGINT (POSIX standard 128 + 2)
Graceful Cancellation: Pressing Ctrl+C immediately cancels all running threads and active socket connections, cleans up terminal cursor lines, outputs a message to stderr, and exits cleanly with code 130 without traceback dumps.
🛡️ License
Distributed under the GNU General Public License v3 (GPL-3.0). See LICENSE for details.
N
Netcheck
farman20ali·3 yıldız·
Comprehensive cross-platform network diagnostics CLI & MCP server (TCP, DNS, HTTP, SSL, Traceroute, Port Scan).
Henüz araç listesi yok. Uzak sunucular ilk sağlık kontrolünden sonra bir liste alır.
SSS
Sorular
Netcheck nasıl kurulur?
Bu sayfadan Cursor, Claude Desktop, Claude Code veya VS Code için stdio yapılandırmasını kopyalayın. PlugMCP proxy'sini değil, yayıncının kurulumunu kullanır.
Netcheck için API anahtarı gerekiyor mu?
Bu kayıtta gerekli bir ortam değişkeni listelenmiyor.
Netcheck hangi aktarımı kullanıyor?
Netcheck yerel olarak stdio üzerinden çalışır.
Netcheck en son ne zaman kontrol edildi?
Son kontrol: 2026-10-28. Comprehensive cross-platform network diagnostics CLI & MCP server (TCP, DNS, HTTP, SSL, Traceroute, Port Scan).