feat(notify): 告警补服务端掉线/Agent 不可达/配置漂移,巡检改 Source 接口(v1.2.10)
- 三个新事件(默认关闭):公网服务端掉线、公网 agent 不可达、配置漂移;连续失败阈值与漂移提醒间隔均可配,达标与恢复各报一次 - 避免误报:只在「用户要服务端运行」时判定掉线;ConnectionState=unknown 按健康处理;没配 agent 的服务端不参与可达性判定 - internal/monitor 改 Source 接口(Routes/Servers/Agents/Drift),frp 适配在 internal/app/monitor_source.go;「连续 N 次」抽成共用 failureTransition,通知一律在锁外调用 - 通知图标分类补齐;通知方式标签改「Webhook / IM 机器人」;新增 6 个设置项;补 serverDown/serverLabel/stateOr 测试 - agent 无改动,AgentVersion 保持 0.12.2
This commit is contained in:
@@ -3,7 +3,7 @@ export interface NotifyEventOption {
|
||||
label: string
|
||||
hint?: string
|
||||
hasThreshold?: boolean
|
||||
thresholdKey?: 'ip_frequent' | 'login_failure' | 'resource' | 'tunnel_fail'
|
||||
thresholdKey?: 'ip_frequent' | 'login_failure' | 'resource' | 'tunnel_fail' | 'frps_fail' | 'agent_fail' | 'drift_cooldown'
|
||||
}
|
||||
|
||||
export interface NotifyEventGroup {
|
||||
@@ -85,6 +85,27 @@ export const NOTIFY_EVENT_GROUPS: NotifyEventGroup[] = [
|
||||
hasThreshold: true,
|
||||
thresholdKey: 'tunnel_fail',
|
||||
},
|
||||
{
|
||||
key: 'on_frps_down',
|
||||
label: '公网服务端掉线',
|
||||
hint: '服务端进程没在跑或隧道连不上 frps(手动停止的不报),恢复时再通知一次',
|
||||
hasThreshold: true,
|
||||
thresholdKey: 'frps_fail',
|
||||
},
|
||||
{
|
||||
key: 'on_agent_unreachable',
|
||||
label: '公网 agent 不可达',
|
||||
hint: 'VPS 上的 fonu-agent 连续无响应(重启后没起来最常见),恢复时再通知一次',
|
||||
hasThreshold: true,
|
||||
thresholdKey: 'agent_fail',
|
||||
},
|
||||
{
|
||||
key: 'on_route_drift',
|
||||
label: '配置漂移',
|
||||
hint: 'VPS 上的 vhost 与 Fonu 记录不一致(被手工改过或重装后未重部署),同一台按提醒间隔重复提醒',
|
||||
hasThreshold: true,
|
||||
thresholdKey: 'drift_cooldown',
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -97,3 +118,6 @@ export const DEFAULT_CPU_THRESHOLD = 90
|
||||
export const DEFAULT_MEMORY_THRESHOLD = 90
|
||||
export const DEFAULT_DISK_THRESHOLD = 85
|
||||
export const DEFAULT_TUNNEL_FAIL_THRESHOLD = 3
|
||||
export const DEFAULT_FRPS_FAIL_THRESHOLD = 2
|
||||
export const DEFAULT_AGENT_FAIL_THRESHOLD = 3
|
||||
export const DEFAULT_DRIFT_COOLDOWN_HOURS = 24
|
||||
|
||||
@@ -3,7 +3,8 @@ import type { NotifyType, WebhookProvider } from '../api/types'
|
||||
export const NOTIFY_TYPE_OPTIONS: { label: string; value: NotifyType }[] = [
|
||||
{ label: '关闭', value: '' },
|
||||
{ label: '邮件(SMTP)', value: 'email' },
|
||||
{ label: 'Webhook', value: 'webhook' },
|
||||
// 企业微信 / 钉钉 / 飞书机器人都是「POST 一个 URL + JSON」,归在 Webhook 预设里,标签要说明白
|
||||
{ label: 'Webhook / IM 机器人', value: 'webhook' },
|
||||
{ label: 'Telegram 机器人', value: 'telegram' },
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user