초기 커밋
This commit is contained in:
54
app/schemas/monitoring.py
Normal file
54
app/schemas/monitoring.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class AlertRuleRead(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
description: str
|
||||
metric: str
|
||||
condition: str
|
||||
threshold: float
|
||||
severity: str
|
||||
is_enabled: bool
|
||||
device_group_id: int | None
|
||||
created_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class AlertRuleCreate(BaseModel):
|
||||
name: str
|
||||
description: str = ""
|
||||
metric: str
|
||||
condition: str
|
||||
threshold: float
|
||||
severity: str = "warning"
|
||||
device_group_id: int | None = None
|
||||
|
||||
|
||||
class AlertRead(BaseModel):
|
||||
id: int
|
||||
rule_id: int | None
|
||||
device_id: int | None
|
||||
severity: str
|
||||
message: str
|
||||
is_acknowledged: bool
|
||||
acknowledged_by: int | None
|
||||
acknowledged_at: datetime | None
|
||||
created_at: datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class SystemHealthResponse(BaseModel):
|
||||
status: str
|
||||
mariadb: str
|
||||
mongodb: str
|
||||
redis: str
|
||||
mqtt: str
|
||||
active_devices: int
|
||||
active_alerts: int
|
||||
Reference in New Issue
Block a user