Skip to main content

A health checker package to report using MQTT

Project description

healthcheck-reporter

Lightweight health reporter that periodically probes database TCP connectivity and publishes a JSON report to MQTT.

Installation

pip install healthcheck-reporter

Usage

from healthcheck_reporter import Reporter, ReporterConfig

config = ReporterConfig(
    database_host="db.example.local",
    database_port=5432,
    database_name="appdb",
    database_password="secret",
    mqtt_host="mqtt.example.local",
    mqtt_port=1883,
    mqtt_client_id="service-A-health",
    mqtt_topic="services/health",
    mqtt_user=None,      # or "user"
    mqtt_password=None,  # or "password"
)

reporter = Reporter(
    config,
    interval_seconds=30.0,  # configurable, non-blocking
)

reporter.start()

# ... your service runs ...

# On shutdown
reporter.stop()

Published payload

{
  "database_status": "ok",
  "mqtt_client_id": "service-A-health",
  "timestamp": "2025-01-01T00:00:00+00:00"
}

Notes

  • Database probe is a TCP connect to database_host:database_port; no queries or DB drivers.
  • MQTT publish uses QoS 1 and reconnects if needed.
  • start() runs a background thread (non-blocking). Use stop() on shutdown.

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

healthcheck_reporter-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

healthcheck_reporter-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file healthcheck_reporter-0.1.1.tar.gz.

File metadata

  • Download URL: healthcheck_reporter-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for healthcheck_reporter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5c6489584e488a71b7603d634e359ab19ec2c14e552a99df5fe4870f9fc07443
MD5 1462166d705b2d98b96e33afaff39f1c
BLAKE2b-256 5971e80470284359b601c6b0ad51840dc336f1217be51658b65bf5363df86c8e

See more details on using hashes here.

File details

Details for the file healthcheck_reporter-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for healthcheck_reporter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c01d62513ff2429b35b171c3b4dcbe1a8a49e514caef3f00f409d07f940a87f
MD5 41618ead865e9e5bbffc53dba9f49659
BLAKE2b-256 593ce843942c5a2fd7dda3a79d2c7affff78ae291dacd7f891cf8458875cd431

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