Skip to main content

Service Health Checker

service-health-checker is a Python library that validates the health of critical service dependencies and reports whether your system is safe to run.

It is designed for:

  • production readiness checks
  • container health checks
  • Kubernetes readiness probes
  • CI/CD deployment checks

Features

  • Health checks for dependencies such as:
    • databases
    • cache systems
    • message queues
    • external APIs
    • storage services
  • Simple status model: OK or FAILED
  • Aggregated report with optional fail-fast exit code for automation
  • Lightweight, no third-party dependencies

Installation

pip install service-health-checker

Quick Start (Library)

from service_health_checker import (
    ServiceMonitor,
    tcp_check,
    http_check,
    disk_space_check,
)

monitor = ServiceMonitor(timeout=3.0)

monitor.add_check("Database", tcp_check(host="127.0.0.1", port=5432))
monitor.add_check("Redis", tcp_check(host="127.0.0.1", port=6379))
monitor.add_check("Kafka", tcp_check(host="127.0.0.1", port=9092))
monitor.add_check("External API", http_check(url="https://api.example.com/health"))
monitor.add_check("Disk Space", disk_space_check(path="/", min_free_percent=10.0))

report = monitor.run()
print(report.to_table())

if not report.is_healthy:
    raise SystemExit("System is not safe to run")

Example Output

Service Health Report

Database        OK
Redis           OK
Kafka           OK
External API    FAILED
Disk Space      OK

CLI Usage

The package provides a CLI command:

service-health-check --http "External API=https://api.example.com/health" --disk "Disk Space=/,10"

Additional examples:

service-health-check \
  --tcp "Database=127.0.0.1:5432" \
  --tcp "Redis=127.0.0.1:6379" \
  --tcp "Kafka=127.0.0.1:9092" \
  --http "External API=https://api.example.com/health" \
  --disk "Disk Space=/,10" \
  --json

Exit codes:

  • 0 when all checks are healthy
  • 1 when one or more checks fail

Built-in Checks

  • tcp_check(host, port)
  • http_check(url, method="GET")
  • disk_space_check(path="/", min_free_percent=10.0)

API Overview

  • ServiceMonitor(timeout=3.0)
  • add_check(name, check_fn)
  • run() -> HealthReport

HealthReport provides:

  • results: list of individual service results
  • is_healthy: boolean overall status
  • to_table(): human-readable report
  • to_dict(): structured output

Metadata

Release files for service-health-checker 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for service-health-checker 0.1.0
File Size Uploaded Provenance Actions
service_health_checker-0.1.0.tar.gz 5.9 kB Without provenance Details for service_health_checker-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for service-health-checker 0.1.0
File Interpreter ABI Platform Actions
service_health_checker-0.1.0-py3-none-any.whl Python 3 none any Details for service_health_checker-0.1.0-py3-none-any.whl

Total release size: 13.0 kB

Release files / service_health_checker-0.1.0.tar.gz

Download URL service_health_checker-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
885895cd985b145cdd4ce1ab5cc49d1d89463be55abf7e7bea71d384799ce0a5
BLAKE2b-256 checksum
How to use checksums
df66b5abccd63e155414fc49d29b4571ae026fbb9a29cfa36481820e5e226089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / service_health_checker-0.1.0-py3-none-any.whl

Download URL service_health_checker-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c42cea5237987284689f5f2b90b1696803209f2613df98fb5074493631c992e8
BLAKE2b-256 checksum
How to use checksums
4551762d70321e4e7a67dda3866022b71bd257b31a850c003202d3b2b6b86499
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for service-health-checker 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page