mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-31 07:12:23 -07:00
feat: add health check endpoint and related schemas with tests
This commit is contained in:
@@ -651,6 +651,34 @@ class NetworkInterfacesResponse(BaseResponse):
|
||||
interfaces: Dict[str, Any] = Field(..., description="Details about network interfaces.")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# HEALTH CHECK SCHEMAS
|
||||
# =============================================================================
|
||||
|
||||
|
||||
class HealthCheckResponse(BaseResponse):
|
||||
"""System health check with vitality metrics."""
|
||||
model_config = ConfigDict(
|
||||
extra="allow",
|
||||
json_schema_extra={
|
||||
"examples": [{
|
||||
"success": True,
|
||||
"db_size_mb": 125.45,
|
||||
"mem_usage_pct": 65,
|
||||
"load_1m": 2.15,
|
||||
"storage_pct": 42,
|
||||
"cpu_temp": 58
|
||||
}]
|
||||
}
|
||||
)
|
||||
|
||||
db_size_mb: float = Field(..., description="Database size in MB (app.db + app.db-wal)")
|
||||
mem_usage_pct: int = Field(..., ge=0, le=100, description="Memory usage percentage (0-100)")
|
||||
load_1m: float = Field(..., description="1-minute load average")
|
||||
storage_pct: int = Field(..., ge=0, le=100, description="Disk usage percentage of /data mount (0-100)")
|
||||
cpu_temp: Optional[int] = Field(None, description="CPU temperature in Celsius (nullable if unavailable)")
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# EVENTS SCHEMAS
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user