Network health monitoring script with MQTT reporting for Home Assistant. - Ping, HTTP, and SNMP checkers - MQTT Discovery for automatic entity creation - Configurable check intervals Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
22 lines
440 B
Python
22 lines
440 B
Python
from abc import ABC, abstractmethod
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
|
|
|
|
@dataclass
|
|
class CheckResult:
|
|
success: bool
|
|
message: str
|
|
response_time: float | None = None
|
|
details: dict[str, Any] | None = None
|
|
|
|
|
|
class BaseChecker(ABC):
|
|
def __init__(self, name: str, config: dict):
|
|
self.name = name
|
|
self.config = config
|
|
|
|
@abstractmethod
|
|
def check(self) -> CheckResult:
|
|
pass
|