Skip to main content

One CLI for network troubleshooting: traceroute with BGP/ASN, DNS, latency, VPN checks, and SRE on-call presets.

Project description

netdiag

Production runbook CLI for network incidents - traceroute with ASN/BGP, DNS drift, latency, VPN checks, and on-call presets in one binary.

CI Python License

Stdlib-only at runtime · --json on every command · Exit codes built for automation

netdiag doctor
netdiag oncall <HOST> --json

Install

Method Command
From source (dev) python3 -m pip install -e ".[dev]"
PyPI python3 -m pip install netdiag-cli
From Git python3 -m pip install "git+https://github.com/akintunero/netdiag.git"

Use python3 -m pip (not bare pip) on macOS if pip is missing. The PyPI package is netdiag-cli; the command is still netdiag.

System tools: ping (required), plus traceroute, dig, and routing/socket tools as needed. Run netdiag doctor to see what is on your PATH.


Runbook workflow

Step Command Exit code
1. Pre-flight netdiag doctor 0 ready · 2 missing required tools
2. Incident check netdiag oncall <HOST> --json 0 pass · 1 fail · 2 error
3. Ticket artifact netdiag report <HOST> -o incident.md same

Exit code semantics are stable in v0.x - see docs/CLI_CONTRACT.md.

netdiag oncall 1.1.1.1 --json
netdiag oncall YOUR-SERVICE.example.com --json | jq '.steps[] | select(.ok==false)'

Tip: Run one command per line. Do not paste trailing # comments from docs into zsh/bash.

VPN and corporate DNS

netdiag vpn --corp intranet.company.com
netdiag oncall app.internal --corp app.internal --vpn --json

Optional config

Copy docs/config.example.toml to ~/.config/netdiag/config.toml:

[defaults]
corp_host = "app.internal.corp"

[oncall]
preset = "oncall"

Shell completions

eval "$(netdiag completion bash)"
eval "$(netdiag completion zsh)"

About the CLI

netdiag --info    # version, platform, repo links, wordmark banner

Set NETDIAG_NO_BANNER=1 to hide the banner.


Why operators use it

One CLI Replaces ad-hoc dig + ping + curl + traceroute scripts
--json PagerDuty, CI, Slack bots, jq filters
Presets web, api, vpn, oncall - tuned check bundles
Small runtime No required PyPI dependencies

Quick start (developers)

git clone https://github.com/akintunero/netdiag.git
cd netdiag
python3 -m pip install -e ".[dev]"
netdiag doctor
python3 -m pytest tests/ -q

Smoke test (live network, all subcommands):

bash scripts/cli_smoke.sh

Example probes:

netdiag oncall 1.1.1.1 --json
netdiag oncall 1.1.1.1 --preset api --json
netdiag trace 8.8.8.8 -m 12 --no-bgp-api
netdiag report 1.1.1.1 -o incident.md

Command reference

Command Description
doctor Pre-flight: required tools for runbooks
oncall Primary incident bundle (preset oncall)
report Markdown report (-o file.md, --vpn)
vpn VPN, split-tunnel, DNS drift
check Health check; --preset for bundles
trace Traceroute + ASN/BGP enrichment
ping / latency RTT, jitter, percentiles
dns / dns-trace / dns-compare / dns-all DNS tooling
port / ports TCP probes and scans
http / tls / redirects / headers Application layer
speed CDN throughput (Cloudflare by default)
compare Two-host DNS + ping diff
presets List available presets
completion bash / zsh completions

Also: route, ifaces, local-ports, connections, whois, subnet, ip, ptr, mtr, and more - netdiag --help.

All commands support --json.


Documentation

Doc Link
Docs index docs/README.md
Cookbook (on-call recipes) docs/cookbook.md
CLI contract (exit codes, flags) docs/CLI_CONTRACT.md
Contributing CONTRIBUTING.md
Security SECURITY.md
Roadmap ROADMAP.md
Changelog CHANGELOG.md

Author

Olúmáyòwá Akinkuehinmi - @akintunero · akintunero101@gmail.com

License

MIT - see LICENSE.

Responsible use

Use only on networks and hosts you are authorized to test.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netdiag_cli-0.1.0.tar.gz (57.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netdiag_cli-0.1.0-py3-none-any.whl (58.4 kB view details)

Uploaded Python 3

File details

Details for the file netdiag_cli-0.1.0.tar.gz.

File metadata

  • Download URL: netdiag_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 57.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for netdiag_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 28c5d54fdd36e3006a26c224d5b16fca57bb01b97e1f72b3333a36dbb2cacb95
MD5 05aa06188ace7a2c9e5fc680f6000ab9
BLAKE2b-256 c9e4e7eca99d0ff9a2be350692c645649eda77e373917e9cbf2cc561c212e714

See more details on using hashes here.

File details

Details for the file netdiag_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: netdiag_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 58.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for netdiag_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ff78144304445ad266178002a8bb03417228906607d2b154c3ab6ae87f733f
MD5 79ce01febe7a9cf18e635da177ea69ef
BLAKE2b-256 30588bf112795680054fbf88b2c421704b85bfa0f82638ddcf5fa65cc8461db8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page