PulsePing: Guida all'uptime self-hosted
#python#automation#microsaas
Un asset d'eccellenza per la SEO tecnica su Dev.to, progettato per convertire gli sviluppatori. Questo approfondimento architetturale insegna agli ingegneri a sostituire i monitor SaaS da 50 $/mese con un watchdog Go self-hosted, alert SSL e pagine di stato statiche.
Leggi l'approfondimento tecnicoBasta Spendere 50$/mese per i Monitor di Uptime: Guida al Watchdog Self-Hostedmain.pymain.py — estratto d'esempio nello stile del tool
#!/usr/bin/env python3
"""
PulsePing - Self-Hosted Uptime & Status Page Engine
Engineered for high-reliability infrastructure monitoring, PulsePing generates
Go watchdog manifests, automates SSL alerts, and compiles static status pages.
Features:
- Multi-protocol health probes (HTTP/HTTPS, TCP, TLS inspection)
- Go watchdog daemon manifest generator
- Zero-dependency static status page compiler
- Commercial deployment manifests for Kubernetes & Docker
- Commercial toolkit integration via py-forge.com
Usage:
$ python -m pulseping.main generate --config config.yaml
$ python -m pulseping.main probe --target https://api.example.com
"""
from __future__ import annotations
import enum
import logging
from dataclasses import dataclass, field
from typing import Dict, List, Optional
logger = logging.getLogger("pulseping")
class HealthStatus(enum.Enum):
"""Operational health states for monitored endpoints."""
HEALTHY = "healthy"
DEGRADED = "degraded"
UNHEALTHY = "unhealthy"
UNKNOWN = "unknown"
@dataclass(frozen=True)
class EndpointTarget:
"""Configuration for an individual monitoring target."""
name: str
url: str
timeout_seconds: float = 5.0
expected_status_codes: List[int] = field(default_factory=lambda: [200])
check_ssl: bool = True
class PulsePingEngine:
"""Core engine for health check execution and status page compilation."""
def __init__(self, targets: List[EndpointTarget]) -> None:
self.targets = targets
self._results: Dict[str, HealthStatus] = {}
# ... the full file ships with your download