Files
v6ole 848f804169 PingWatch 网络设备离线监控系统
- FastAPI 后端 + Vue 3 前端
- Docker Compose 一键部署
- Casdoor OAuth 认证集成
- LogHive 集中式日志
- 设备批量 CSV 导入/导出
- WebSocket 实时状态推送
- 企业微信告警通知
- fping 高性能并发 Ping 检测

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 15:02:04 +08:00

50 lines
1.2 KiB
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, IPvAnyAddress
class DeviceCreate(BaseModel):
name: str
ip: str
device_type: str = "other"
location: str = ""
project_name: str = ""
tags: str = ""
ping_interval: int = 30
alert_threshold: int = 5
is_enabled: bool = True
class DeviceUpdate(BaseModel):
name: Optional[str] = None
ip: Optional[str] = None
device_type: Optional[str] = None
location: Optional[str] = None
project_name: Optional[str] = None
tags: Optional[str] = None
ping_interval: Optional[int] = None
alert_threshold: Optional[int] = None
is_enabled: Optional[bool] = None
class DeviceOut(BaseModel):
id: int
name: str
ip: str
device_type: str
location: str
project_name: str
tags: str
ping_interval: int
alert_threshold: int
is_enabled: bool
current_status: str
consecutive_failures: int
last_ping_time: Optional[datetime] = None
last_online_time: Optional[datetime] = None
last_offline_time: Optional[datetime] = None
created_at: datetime
updated_at: datetime
model_config = {"from_attributes": True}