← Back to all products
$19
Health Check System
HTTP and TCP health check system with configurable intervals, thresholds, and notification alerts.
JSONMarkdownPythonCI/CD
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 9 files
health-check-system/
├── LICENSE
├── README.md
├── examples/
│ └── health_config.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_configuration-reference.md
│ └── 03_license.md
├── index.html
└── src/
└── health_checker.py
📖 Documentation Preview README excerpt
Health Check System
Part of the Deploy Kit by CodeVault
Comprehensive health check and monitoring tool for your infrastructure. Performs HTTP endpoint checks, TCP port scans, DNS resolution tests, and SSL certificate validation — then generates JSON reports and triggers alerts when things go wrong.
Features
- HTTP Health Checks: GET/HEAD requests with status code, response time, and body validation
- TCP Port Checks: Verify that services are listening on expected ports
- DNS Resolution Checks: Validate domain name resolution and expected IP addresses
- SSL Certificate Checks: Verify cert validity, expiry dates, and chain completeness
- Configurable check intervals and timeout thresholds
- Alert thresholds: warn when response time exceeds limits
- JSON report output with timestamps and historical trends
- Multi-target checking from a single config file
- Exit codes for CI/CD integration (0 = all healthy, 1 = failures)
- Python stdlib only — zero dependencies
Quick Start
# Run all health checks from the example config
python src/health_checker.py --config examples/health_config.json
# Output as JSON report
python src/health_checker.py --config examples/health_config.json --format json
# Write report to file
python src/health_checker.py --config examples/health_config.json --format json --output report.json
# Run only HTTP checks
python src/health_checker.py --config examples/health_config.json --type http
# Set custom timeout
python src/health_checker.py --config examples/health_config.json --timeout 10
# Verbose output for debugging
python src/health_checker.py --config examples/health_config.json -v
Configuration Reference
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name of the health check suite |
checks | array | Yes | List of check definitions |
defaults | object | No | Default timeout and thresholds |
alerts | object | No | Alerting configuration |
Check Definition
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable check name |
type | string | Yes | http, tcp, dns, or ssl |
target | string | Yes | URL, host:port, or domain to check |
expected_status | int | No | Expected HTTP status code (default: 200) |
timeout | int | No | Check timeout in seconds |
warn_threshold_ms | int | No | Response time warning threshold |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/health_checker.py
#!/usr/bin/env python3
"""
Health Check System — Deploy Kit by DataNest
Comprehensive infrastructure health checker supporting HTTP endpoint checks,
TCP port scans, DNS resolution validation, and SSL certificate inspection.
Outputs human-readable reports or structured JSON for CI/CD integration.
Why this exists:
After deploying, you need to know things are actually working. Pinging
endpoints manually is tedious and error-prone. This tool checks HTTP
status codes, TCP connectivity, DNS resolution, and SSL certificates
from a single config file and gives you a clear pass/fail report.
Usage:
python health_checker.py --config health.json
python health_checker.py --config health.json --format json
python health_checker.py --config health.json --type http
python health_checker.py --config health.json --output report.json
License: MIT
"""
from __future__ import annotations
import argparse
import json
import logging
import socket
import ssl
import sys
import time
import urllib.request
import urllib.error
from dataclasses import dataclass, field
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
CHECK_TYPES = {"http", "tcp", "dns", "ssl"}
DEFAULT_TIMEOUT = 10
DEFAULT_WARN_MS = 500
LOG = logging.getLogger("health-checker")
# ---------------------------------------------------------------------------
# ... 522 more lines ...