Skip to main content

A flexible, extensible Python library for monitoring TCP, HTTP, SSL certificates, domain expiry, DNS, and more

Project description

PyUptimeKit

A flexible, extensible Python library for monitoring infrastructure health. PyUptimeKit provides independent, reusable modules for TCP connectivity, HTTP/HTTPS uptime, SSL certificate validation, domain expiry checks, DNS monitoring, ICMP ping, and content validation.

Features

  • Modular Design: Each monitor type is independent and reusable
  • Type-Safe: Full type hints and Pydantic validation throughout
  • Extensible: Easy to add custom monitor types via common interfaces
  • Flexible Dependencies: Optional extras for specific monitor types
  • Alpha Release: Under active development with comprehensive error handling and result normalization

Monitor Types

  • TCP: Raw TCP port connectivity and latency checks
  • HTTP/HTTPS: Web endpoint monitoring with status code validation
  • SSL Certificate: Certificate expiry, issuer, and validity checks
  • Domain Expiry: WHOIS-based domain registration expiry monitoring
  • DNS: DNS resolution and record validation
  • Ping: ICMP echo request monitoring (platform-dependent)
  • Keyword: HTTP response content validation

Installation

Core Library

pip install pyuptimekit

With Optional Dependencies

# HTTP monitoring
pip install pyuptimekit[http]

# Domain expiry monitoring
pip install pyuptimekit[domain]

# DNS monitoring
pip install pyuptimekit[dns]

# Ping monitoring
pip install pyuptimekit[ping]

# All monitor types
pip install pyuptimekit[all]

# Development tools
pip install pyuptimekit[dev]

Quick Start

Individual Monitor Usage

from pyuptimekit.monitors.tcp import TcpMonitor
from pyuptimekit.models.target import TcpTarget
from pyuptimekit.models.config import TcpConfig

# Create and run a TCP monitor
target = TcpTarget(host="google.com", port=443)
config = TcpConfig(timeout=5)
monitor = TcpMonitor(target=target, config=config)
result = monitor.run()

print(f"Status: {result.status}")
print(f"Latency: {result.duration_ms}ms")

Batch Monitoring with Engine

from pyuptimekit.engine.runner import MonitoringEngine
from pyuptimekit.monitors.tcp import TcpMonitor
from pyuptimekit.monitors.ssl import SslCertificateMonitor

# Create monitoring engine
engine = MonitoringEngine()

# Register monitors
engine.add_monitor(TcpMonitor(host="google.com", port=443))
engine.add_monitor(SslCertificateMonitor(host="github.com"))

# Run all monitors
results = engine.run_all()

for result in results:
    print(f"{result.target}: {result.status}")

Architecture

PyUptimeKit follows a clean architecture with separation of concerns:

pyuptimekit/
├── interfaces/     # Common monitor contracts
├── models/         # Pydantic models for configs, results, targets
├── monitors/       # Individual monitor implementations
├── engine/         # Orchestration and batch execution
├── exceptions/     # Typed exception hierarchy
├── config/         # Default configurations
└── utils/          # Shared utilities

Each monitor implements a common interface and returns a standardized MonitorResult, making it easy to integrate into dashboards, alerting systems, or custom workflows.

Development

Setup

# Clone the repository (URL will be added when published)
pip install -e ".[dev,all]"

Building the Package

# Build wheel and source distribution (requires build tool from dev extra)
python -m build

# Check package metadata
twine check dist/*

Running Tests

# Run all tests
pytest

# Run only unit tests (no network)
pytest -m unit

# Run with coverage
pytest --cov=pyuptimekit --cov-report=html

Code Quality

# Format code
black src/ tests/

# Lint
ruff check src/ tests/

# Type check
mypy src/

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

MIT License - see LICENSE file for details.

Roadmap

  • Async monitor implementations (currently synchronous only)
  • Parallel execution in monitoring engine
  • Retry strategies with exponential backoff
  • Monitor result history and trend analysis
  • Prometheus metrics export
  • WebSocket monitoring
  • Database connectivity checks
  • Custom monitor plugins system

Credits

Built with inspiration from monitoring tools like Uptime Kuma, Pingdom, and StatusCake.

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

pyuptimekit-0.1.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

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

pyuptimekit-0.1.0-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyuptimekit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9666401bc1b46d0786aa26c92d5440bc3060f980441a068fbfc5106ac449d90c
MD5 a31b99912deff56d4ac037dce73c354b
BLAKE2b-256 b35bc12acb20c9aad305fed0142970cbaca3e7100a6620b952739d3db5c11424

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyuptimekit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52e4840c1e964d7f5d65325bd3a2a30310a809d10ec6cffb1b92689935d0f22c
MD5 c8f80e4d745c6bebd376d7a96661e359
BLAKE2b-256 3f5b1d71d4aa22997a19b5ca4d275985050c3a039847f4fffc5078a2b40a70f9

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