Files
panel/internal/request/notify.go
T
耗子 4e28fc60a3 feat: 添加通知与告警模块
- 通知渠道支持配置多个 SMTP 账号,配置整体加密落库,删除时清理规则与事件设置中的引用
- 告警规则支持 18 种指标:CPU/内存/Swap/负载/磁盘用量与 inode/磁盘与网卡速率/网站 5xx 与错误率、
  服务与项目与容器与应用与数据库运行状态、证书与网站剩余天数,可配连续命中次数与静默期
- 系统事件通知覆盖证书续签失败、备份失败、后台任务失败、计划任务失败、网站到期、防篡改拦截、
  面板健康问题、面板登录与爆破、SSH 登录与爆破
- 计划任务统一经 wrapper 执行以捕获退出码,flock 抢锁失败不计为失败
- 监控页改造为系统/告警/设置三 Tab
- 数据库驱动建连打通 context 并补齐连接超时,探测不再阻塞告警评估

close #1041

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 22:45:51 +08:00

24 lines
882 B
Go

package request
import "encoding/json"
type NotifyChannelCreate struct {
Name string `json:"name" form:"name" validate:"required"`
Type string `json:"type" form:"type" validate:"required && in:smtp"`
Config json.RawMessage `json:"config" form:"config"`
Enabled bool `json:"enabled" form:"enabled"`
}
type NotifyChannelUpdate struct {
ID uint `json:"id" form:"id" uri:"id" validate:"required && exists:notify_channels,id"`
Name string `json:"name" form:"name" validate:"required"`
Type string `json:"type" form:"type" validate:"required && in:smtp"`
Config json.RawMessage `json:"config" form:"config"`
Enabled bool `json:"enabled" form:"enabled"`
}
type NotifySetting struct {
Events []string `json:"events" form:"events"`
Channels []uint `json:"channels" form:"channels"`
}