feat(monitor): F6 日志告警引擎 — AlertEngine 支持 type=log 规则查询Loki/ES+触发/恢复 + 数据源认证升级(none/basic/bearer/custom) + 从查询创建告警真实API对接

This commit is contained in:
attacker committed 2026-06-28 04:00:38 +08:00
1 parent 894cb16a05
commit 6bba6144f3
17 files changed
+657 -74

No files matched your search

+2 -2
View File
@@ -27,8 +27,8 @@ export const agentApi = {
resolveAlert: (id: number) => http.post(`/agent/alerts/${id}/resolve`),
// 健康探针
getHealthProbes: (params?: Record<string, string>) => http.get('/agent/health-probes', params),
createHealthProbe: (data: Record<string, unknown>) => http.post('/agent/health-probes', data),
updateHealthProbe: (id: number, data: Record<string, unknown>) => http.put(`/agent/health-probes/${id}`, data),
createHealthProbe: (data: object) => http.post('/agent/health-probes', data),
updateHealthProbe: (id: number, data: object) => http.put(`/agent/health-probes/${id}`, data),
deleteHealthProbe: (id: number) => http.delete(`/agent/health-probes/${id}`),
// 端口策略
getPortPolicy: (hostname: string) => http.get(`/agent/port-policies/${hostname}`),
+3 -2
View File
@@ -1,6 +1,7 @@
// 告警规则 / 通知渠道 / 联系人 API // Logan.Li
import { http, type ListResponse } from '@/utils/request';
import type { AlertRuleInput } from '@/types/monitor';
export const alertApi = {
getAlerts: async (params?: { page?: number; page_size?: number; status?: string; severity?: string }) => {
@@ -9,10 +10,10 @@ export const alertApi = {
getRules: async () => {
return http.get('/alerts/rules');
},
createRule: async ( data: Record<string, unknown>) => {
createRule: async (data: AlertRuleInput) => {
return http.post('/alerts/rules', data);
},
updateRule: async (id: number | string, data: Record<string, unknown>) => {
updateRule: async (id: number | string, data: AlertRuleInput) => {
return http.put(`/alerts/rules/${id}`, data);
},
deleteRule: async (id: number | string) => {
+3
View File
@@ -7,9 +7,12 @@ export interface LogDataSource {
name: string;
type: 'loki' | 'elasticsearch';
url: string;
auth_type?: 'none' | 'basic' | 'bearer' | 'custom';
basic_auth?: boolean;
basic_auth_user?: string;
basic_auth_pass?: string;
token?: string;
headers?: string; // JSON 字符串,如 [{"name":"X-Scope-OrgID","value":"tenant-1"}]
skip_tls_verify?: boolean;
default_index?: string;
is_default?: boolean;