DEV Community

Cover image for Building JC SRE NetProbe: A Python CLI for Network Health Checks, DevOps, and SRE
JacivaldoCarvalho
JacivaldoCarvalho

Posted on

Building JC SRE NetProbe: A Python CLI for Network Health Checks, DevOps, and SRE

Introduction

As a Telecommunications Engineer interested in Networking, DevOps, and Site Reliability Engineering (SRE), I've always been fascinated by how different layers of network infrastructure work together to deliver reliable services.

When an application becomes unavailable, the problem isn't necessarily the application itself.

It could be a DNS resolution issue, a TCP connection failure, an expired TLS certificate, or an HTTP service returning an unexpected response.

Understanding where the failure occurs is an important part of troubleshooting.

With that in mind, I built JC SRE NetProbe, an open-source Python command-line tool designed to simplify network connectivity checks and basic service health diagnostics.

🔗 GitHub: https://github.com/jacivaldocarvalho/jc-sre-netprobe

What is JC SRE NetProbe?

JC SRE NetProbe is a lightweight Python package that provides network diagnostic utilities through a command-line interface (CLI) and a Python API.

The project brings together several common network checks into a single tool, making it useful for telecommunications professionals, network engineers, DevOps teams, and SRE practitioners.

Its main capabilities include:

  • TCP connectivity checks with latency measurement
  • DNS resolution checks
  • HTTP/HTTPS endpoint health checks
  • IPv4 and IPv6 network information
  • TLS certificate validation and expiration information
  • Configurable timeouts
  • Structured JSON output
  • Exit codes designed for automation

The goal is straightforward: make network troubleshooting easier to execute, understand, and automate.

Why I Built It

In network operations and infrastructure troubleshooting, engineers often need to perform multiple checks to identify why a service is unavailable.

For example, consider an API endpoint that suddenly stops responding.

Several questions immediately come to mind:

  1. Is the hostname resolving correctly?
  2. Can a TCP connection be established?
  3. Is the TLS certificate valid?
  4. Is the HTTP endpoint responding as expected?

Each question investigates a different part of the service delivery process.

I wanted to create a Python tool that could perform these checks consistently while also providing structured results suitable for scripting and automation.

JC SRE NetProbe is a practical project that connects my telecommunications background with software development and SRE practices.

Getting Started

JC SRE NetProbe requires Python 3.11 or newer.

Install the package using pip:

pip install jc-sre-netprobe
Enter fullscreen mode Exit fullscreen mode

Once installed, the CLI is available directly from your terminal.

1. Checking TCP Connectivity

To verify whether a remote service accepts TCP connections:

jc-sre-netprobe tcp github.com 443
Enter fullscreen mode Exit fullscreen mode

This checks connectivity to GitHub on TCP port 443.

TCP connectivity checks are useful when investigating service availability, firewall restrictions, and network connectivity problems.

2. Checking DNS Resolution

DNS plays a critical role in connecting applications to network services.

To check hostname resolution:

jc-sre-netprobe dns github.com
Enter fullscreen mode Exit fullscreen mode

This helps determine whether a hostname can be resolved before investigating higher-level protocols.

3. Checking HTTP/HTTPS Services

A successful TCP connection doesn't necessarily mean that an application is healthy.

To perform an HTTP health check:

jc-sre-netprobe http https://github.com
Enter fullscreen mode Exit fullscreen mode

This provides an application-layer check of the endpoint.

4. Inspecting TLS Certificates

TLS certificates are essential for secure communication.

Expired or invalid certificates can cause application failures even when the underlying network is operational.

To inspect a server's TLS certificate:

jc-sre-netprobe tls github.com
Enter fullscreen mode Exit fullscreen mode

You can also configure a timeout:

jc-sre-netprobe tls github.com --timeout 3
Enter fullscreen mode Exit fullscreen mode

5. Working with IPv4 and IPv6 Networks

The tool also provides network information for IPv4 and IPv6 address ranges.

For example:

jc-sre-netprobe network 192.168.1.0/24
Enter fullscreen mode Exit fullscreen mode

This functionality can be useful when working with IP addressing and network infrastructure.

Designed for Automation

One of the important aspects of JC SRE NetProbe is its ability to integrate with scripts and operational workflows.

JSON Output

For example:

jc-sre-netprobe --json tls github.com
Enter fullscreen mode Exit fullscreen mode

Structured output makes it easier to consume results programmatically and integrate checks into other tools.

Operational Exit Codes

The CLI uses exit codes that can be interpreted by automation systems.

Exit Code Meaning
0 Target is healthy or check succeeded
1 Target is unhealthy or unavailable
2 Invalid CLI usage or input

For example:

jc-sre-netprobe tcp github.com 443
echo $?
Enter fullscreen mode Exit fullscreen mode

This behavior makes the tool useful in shell scripts, CI/CD pipelines, and operational checks.

Using JC SRE NetProbe with Python

In addition to its CLI, the package provides a Python API.

For example, a TCP connectivity check can be performed directly from Python:

from jc_sre_netprobe import tcp_check

result = tcp_check("github.com", 443)

print(result)
Enter fullscreen mode Exit fullscreen mode

TLS checks are also available:

from jc_sre_netprobe import tls_check

result = tls_check("github.com")

print(result)
Enter fullscreen mode Exit fullscreen mode

This allows developers to reuse the network probing functionality inside their own applications and automation scripts.

Development and Code Quality

Beyond implementing network checks, I wanted this project to follow good Python development practices.

The repository includes:

  • Ruff for linting
  • Mypy for static type checking
  • Pytest for automated testing
  • Coverage for test coverage analysis
  • GitHub Actions for CI/CD
  • PyPI Trusted Publishing for package releases

The CI pipeline validates the project against Python 3.11, 3.12, and 3.13.

These practices help make the project more maintainable and provide a foundation for future improvements.

Networking Meets Site Reliability Engineering

One of the aspects I enjoy most about this project is how it connects traditional networking concepts with modern SRE practices.

In telecommunications and network engineering, troubleshooting frequently involves understanding protocols, connectivity, addressing, and service behavior.

In SRE, these same concepts are essential for investigating reliability and availability.

JC SRE NetProbe brings these perspectives together through lightweight black-box checks.

It isn't intended to replace comprehensive monitoring and observability platforms. Instead, it provides focused diagnostic utilities that can complement existing operational workflows.

What's Next?

I plan to continue improving JC SRE NetProbe as I explore new ideas in network automation, Python development, DevOps, and SRE.

Some areas worth exploring include additional diagnostic capabilities, improved automation integrations, and more examples of real-world usage.

As an open-source project, feedback, suggestions, and contributions are welcome.

Final Thoughts

Building JC SRE NetProbe has been an opportunity to combine my telecommunications engineering background with my interest in software development and infrastructure reliability.

I believe that building practical tools is one of the best ways to deepen technical knowledge while contributing something useful to the community.

If you work with networking, telecommunications, DevOps, or SRE, I'd love to hear your thoughts.

What network diagnostic checks do you use most frequently in your daily work?

Feel free to explore the repository, open an issue, or contribute.

⭐ GitHub: https://github.com/jacivaldocarvalho/jc-sre-netprobe


Thanks for reading!

Jacivaldo Carvalho

Telecommunications Engineer | Networking | DevOps | SRE

Top comments (0)