feat(alert-center): 添加飞书Webhook通知渠道 + 告警引擎实时通知

- 后端: NotifyChannel 模型新增 feishu 类型, FeishuWebhookConfig
- 后端: TestNotifyChannel 真实发送飞书测试消息(文本格式)
- 后端: 告警引擎触发/恢复时自动发送飞书通知(sendFeishuAlert/sendFeishuRecovery)
- 后端: AlertEngine 新增 tcp_time_wait/tcp_close_wait/service_process 指标检测
- 后端: NetworkStatModel 新增 TCPCloseWait 字段
- 后端: QuickSetupRules 一键创建6条告警规则(CPU/内存/磁盘/TIME_WAIT/CLOSE_WAIT/进程)
- 后端: 注册 /alerts/quick-setup 路由
- 前端: AlertChannelDialog 新增飞书类型选项
- 前端: helpers 新增 getChannelIcon/getChannelTypeLabel 支持 feishu/dingtalk/wechat
This commit is contained in:
attacker committed 2026-06-24 08:34:43 +00:00
1 parent 7bc5169e8f
commit 5333f6f04a
30 files changed
+2406 -1001

No files matched your search

@@ -16,6 +16,7 @@ import type { NotificationChannel } from './alert-center-helpers';
const CHANNEL_TYPES = [
{ value: 'dingtalk', label: '钉钉', hint: '钉钉机器人: webhook URL + secret' },
{ value: 'wechat', label: '企业微信', hint: '企业微信: webhook URL' },
{ value: 'feishu', label: '飞书', hint: '飞书机器人: {"url":"https://open.feishu.cn/open-apis/bot/v2/hook/..."}' },
{ value: 'email', label: '邮件', hint: '邮件: {"to":"ops@ezops.io"}' },
{ value: 'sms', label: '短信', hint: '短信: {"phones":"13800138000"}' },
{ value: 'webhook', label: 'Webhook', hint: 'Webhook: {"url":"https://..."}' },
@@ -116,12 +116,18 @@ export function getChannelIcon(type: string) {
case 'slack': return <MessageSquare className="w-4 h-4" />;
case 'sms': return <Phone className="w-4 h-4" />;
case 'webhook': return <Zap className="w-4 h-4" />;
case 'feishu': return <Bell className="w-4 h-4 text-blue-500" />;
case 'dingtalk': return <Bell className="w-4 h-4 text-sky-500" />;
case 'wechat': return <MessageSquare className="w-4 h-4 text-green-500" />;
default: return <Bell className="w-4 h-4" />;
}
}
/** 渠道类型中文标签 */
export function getChannelTypeLabel(type: string) {
const map: Record<string, string> = { dingtalk: '钉钉', wechat: '企业微信', email: '邮件', sms: '短信', webhook: 'Webhook' };
const map: Record<string, string> = {
dingtalk: '钉钉', wechat: '企业微信', feishu: '飞书',
email: '邮件', sms: '短信', webhook: 'Webhook',
};
return map[type] || type;
}