feat: 配置版本历史/对比/回滚、国内 IM 通知渠道、阈值告警与 API Token(v1.2.9)
- 配置版本:fsutil 版本化备份(内容相同自动去重),主 nginx.conf 与 VPS vhost 的版本列表/逐行差异/一键回滚,回滚先校验语法与 nginx -t 再写回 - agent 0.12.2:写 vhost 前留版本;nginx -t 校验失败改为恢复上一个可用版本(此前直接删文件),新增域名 vhost 版本端点,双架构二进制已重编 - 通知:补企业微信 / 钉钉 / 飞书机器人,切换预设时服务地址跟随该预设默认值 - 阈值告警:新增 internal/monitor 巡检(CPU/内存/磁盘持续超阈值、隧道连续 N 次未注册),默认关闭,带静默期与恢复通知 - API Token:api_tokens 表 + Authorization Bearer 认证,只读/读写两种范围;令牌管理与改密/退出仅限登录会话
This commit is contained in:
@@ -3,7 +3,7 @@ export interface NotifyEventOption {
|
||||
label: string
|
||||
hint?: string
|
||||
hasThreshold?: boolean
|
||||
thresholdKey?: 'ip_frequent' | 'login_failure'
|
||||
thresholdKey?: 'ip_frequent' | 'login_failure' | 'resource' | 'tunnel_fail'
|
||||
}
|
||||
|
||||
export interface NotifyEventGroup {
|
||||
@@ -71,6 +71,20 @@ export const NOTIFY_EVENT_GROUPS: NotifyEventGroup[] = [
|
||||
label: 'Nginx 重载失败',
|
||||
hint: '保存反代或证书后 Nginx 未能成功重载',
|
||||
},
|
||||
{
|
||||
key: 'on_resource_threshold',
|
||||
label: '资源占用过高',
|
||||
hint: 'CPU / 内存 / 磁盘持续超过阈值,同一项每 30 分钟最多提醒一次',
|
||||
hasThreshold: true,
|
||||
thresholdKey: 'resource',
|
||||
},
|
||||
{
|
||||
key: 'on_tunnel_down',
|
||||
label: '隧道连续不通',
|
||||
hint: '连续多次巡检未在 frps 上注册,恢复时再通知一次',
|
||||
hasThreshold: true,
|
||||
thresholdKey: 'tunnel_fail',
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -79,3 +93,7 @@ export const DEFAULT_IP_FREQUENT_THRESHOLD = 100
|
||||
export const DEFAULT_IP_FREQUENT_WINDOW_SEC = 60
|
||||
export const DEFAULT_LOGIN_FAILURE_THRESHOLD = 5
|
||||
export const DEFAULT_LOGIN_FAILURE_WINDOW_SEC = 300
|
||||
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
|
||||
|
||||
@@ -11,9 +11,15 @@ export const WEBHOOK_PROVIDER_OPTIONS: { label: string; value: WebhookProvider }
|
||||
{ label: 'Bark', value: 'bark' },
|
||||
{ label: 'ntfy', value: 'ntfy' },
|
||||
{ label: 'Gotify', value: 'gotify' },
|
||||
{ label: '企业微信机器人', value: 'wecom' },
|
||||
{ label: '钉钉机器人', value: 'dingtalk' },
|
||||
{ label: '飞书机器人', value: 'feishu' },
|
||||
{ label: '自定义 Webhook', value: 'custom' },
|
||||
]
|
||||
|
||||
export const DEFAULT_BARK_SERVER = 'https://api.day.app'
|
||||
export const DEFAULT_NTFY_SERVER = 'https://ntfy.sh'
|
||||
export const DEFAULT_WECOM_SERVER = 'https://qyapi.weixin.qq.com'
|
||||
export const DEFAULT_DINGTALK_SERVER = 'https://oapi.dingtalk.com'
|
||||
export const DEFAULT_FEISHU_SERVER = 'https://open.feishu.cn'
|
||||
export const MASKED_SECRET = '********'
|
||||
|
||||
Reference in New Issue
Block a user