feat(i18n): U45 AI告警分析模块i18n补全 — analyzerHelpers 25处硬编码中文→i18n.t()插值 + 预测图标双语兼容
This commit is contained in:
1 parent
05ee051879
commit
6288fa0071
5 files changed
+89
-31
No files matched your search
@@ -532,6 +532,7 @@ services/api.ts (1324L)
|
|||||||
| U43 | i18n 深度残余硬编码中文 UI 文本清零 — 趋势标签 + K8s 卡片标题 + data-table 默认值 + 趋势文本 + 卡片描述(17 文件 ~40 处→0: AIPredictiveAnalytics 上升/下降/平稳 + PredictiveCostTab 上升/下降/平稳×2 + 当前/阈值/预测 + PredictiveCapacityTab 容量规划预警 + data-table.tsx 搜索.../暂无数据默认值(useTranslation hook) + PodMiscCard Pod 级别 + PodSecurityCard Pod 安全上下文 + HostSettingsCard 4 个主机命名空间描述 + PodInstancesTable Pod 实例 + PodDetailDialog Pod 详情 + HostDetailDialog 指标趋势/端口发现/远程命令/关闭 + DeploymentEditContainers manifest 提示/镜像拉取凭证 + DeploymentEditStorage 数据卷/空状态/挂载/只读/读写 + ClusterOverviewPage 管理全部 + ResourceVisualEditor 新建/编辑 + AgentMonitor 在...上执行命令 + 7 个 K8s 页面刷新按钮(PodMetrics/Capacity/Events/NamespaceResource/NamespaceMgmt/ClusterOverview/KubernetesNodes) + BillingRecord/BillingRuleDialog 保存成功 toast/保存按钮 — 新增 common 30 语义化翻译键(trendUp/trendDown/trendStable/executeOn/podLevel/podSecurityContext/hostNetworkDesc/hostIPCDesk/hostPIDDesk/shareProcessNamespaceDesc/podInstances/podDetail/metricTrend/portDiscovery/remoteCommand/searchPlaceholder/imagePullSecrets/noManifestHint/volumeDefinition/noVolumeHint/mountToContainers/readOnly/readWrite/manageAll/createNew/saveSuccess), zh/en 7898→7928 对齐;tsc -b=0, npm build✓ (16.55s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
| U43 | i18n 深度残余硬编码中文 UI 文本清零 — 趋势标签 + K8s 卡片标题 + data-table 默认值 + 趋势文本 + 卡片描述(17 文件 ~40 处→0: AIPredictiveAnalytics 上升/下降/平稳 + PredictiveCostTab 上升/下降/平稳×2 + 当前/阈值/预测 + PredictiveCapacityTab 容量规划预警 + data-table.tsx 搜索.../暂无数据默认值(useTranslation hook) + PodMiscCard Pod 级别 + PodSecurityCard Pod 安全上下文 + HostSettingsCard 4 个主机命名空间描述 + PodInstancesTable Pod 实例 + PodDetailDialog Pod 详情 + HostDetailDialog 指标趋势/端口发现/远程命令/关闭 + DeploymentEditContainers manifest 提示/镜像拉取凭证 + DeploymentEditStorage 数据卷/空状态/挂载/只读/读写 + ClusterOverviewPage 管理全部 + ResourceVisualEditor 新建/编辑 + AgentMonitor 在...上执行命令 + 7 个 K8s 页面刷新按钮(PodMetrics/Capacity/Events/NamespaceResource/NamespaceMgmt/ClusterOverview/KubernetesNodes) + BillingRecord/BillingRuleDialog 保存成功 toast/保存按钮 — 新增 common 30 语义化翻译键(trendUp/trendDown/trendStable/executeOn/podLevel/podSecurityContext/hostNetworkDesc/hostIPCDesk/hostPIDDesk/shareProcessNamespaceDesc/podInstances/podDetail/metricTrend/portDiscovery/remoteCommand/searchPlaceholder/imagePullSecrets/noManifestHint/volumeDefinition/noVolumeHint/mountToContainers/readOnly/readWrite/manageAll/createNew/saveSuccess), zh/en 7898→7928 对齐;tsc -b=0, npm build✓ (16.55s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
||||||
| U44 | i18n 残余硬编码中文清零 — 终端审计状态 + 凭证类型 + 流水线阶段 + 时间格式 + CSV 导出(20 文件 ~70 处→0: credential-manager/constants.ts 8 凭证类型 label/desc → labelKey/descKey + i18n.t() + pipeline-run-detail/types.ts 6 阶段 label → i18n.t('deploy.stage.*') + labelKey + pipeline-manager/constants.ts + pipeline-editor/types.ts 分秒 duration → i18n.t('common.duration.minSec') + LiveMonitorDialog 6 终端状态消息 → t() + RdpAuditViewer 6 RDP审计状态 → i18n.t('monitor.rdp.*') + WorkspaceTermDialog 2 终端连接状态 → t() + TerminalSessionsTab 4 时长格式+状态标签 → i18n.t()/t() + k8s-event-utils 3 相对时间 → i18n.t('common.duration.*Ago') + QueryHistoryPanel 3 相对时间 → i18n.t('common.duration.*Ago') + export-audit.ts 9 CSV导出表头 → i18n.t('system.auditExport.*') + useAuditSettings 4 审计保留策略消息 → i18n.t('system.auditSettings.*') + event-handler.ts 4 AgentCLI事件消息 → i18n.t('aiops.cli.*') + NotifyPolicyTab 默认平台名 → i18n.t('monitor.notify.defaultPlatform') + RoleFormDialog AIOps智能分组 → i18n.t('system.role.aiopsGroup') + CronJobViewDialog 关联脚本/无命令内容 → t() + TerminalOutput 无输出 → i18n.t('task.terminal.noOutput') + shared-components 内存标签 → i18n.t('k8s.workloadView.memoryLabel') + prometheus-ds/helpers 连接成功 → i18n.t('monitor.prometheus.connSuccess') + CloudServerImport 发现主机失败 → t() + AdvancedSettingsPanel Job名称 → t('deploy.jobName') + releaseManagerHelpers 4 环境标签硬编码中文移除(已有ENV_LABEL_KEY) — 新增 75 翻译键 (deploy.credType 8+credTypeDesc 8+fmtDuration 1+terminal 2+jobName 1, monitor.terminal 6+rdp 6+notify 1+prometheus 1, deploy.terminal 2, common.duration 2, system.terminalSession 4+csvHeader 7+auditExport 9+auditSettings 4+credTypeLabel 3+role 1, task.cronJob 2+terminal 1, k8s.workloadView 1, aiops.cli 5, server.import 1), zh/en 7987→8059 +72 对齐;tsc -b=0, npm build✓ (17.13s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
| U44 | i18n 残余硬编码中文清零 — 终端审计状态 + 凭证类型 + 流水线阶段 + 时间格式 + CSV 导出(20 文件 ~70 处→0: credential-manager/constants.ts 8 凭证类型 label/desc → labelKey/descKey + i18n.t() + pipeline-run-detail/types.ts 6 阶段 label → i18n.t('deploy.stage.*') + labelKey + pipeline-manager/constants.ts + pipeline-editor/types.ts 分秒 duration → i18n.t('common.duration.minSec') + LiveMonitorDialog 6 终端状态消息 → t() + RdpAuditViewer 6 RDP审计状态 → i18n.t('monitor.rdp.*') + WorkspaceTermDialog 2 终端连接状态 → t() + TerminalSessionsTab 4 时长格式+状态标签 → i18n.t()/t() + k8s-event-utils 3 相对时间 → i18n.t('common.duration.*Ago') + QueryHistoryPanel 3 相对时间 → i18n.t('common.duration.*Ago') + export-audit.ts 9 CSV导出表头 → i18n.t('system.auditExport.*') + useAuditSettings 4 审计保留策略消息 → i18n.t('system.auditSettings.*') + event-handler.ts 4 AgentCLI事件消息 → i18n.t('aiops.cli.*') + NotifyPolicyTab 默认平台名 → i18n.t('monitor.notify.defaultPlatform') + RoleFormDialog AIOps智能分组 → i18n.t('system.role.aiopsGroup') + CronJobViewDialog 关联脚本/无命令内容 → t() + TerminalOutput 无输出 → i18n.t('task.terminal.noOutput') + shared-components 内存标签 → i18n.t('k8s.workloadView.memoryLabel') + prometheus-ds/helpers 连接成功 → i18n.t('monitor.prometheus.connSuccess') + CloudServerImport 发现主机失败 → t() + AdvancedSettingsPanel Job名称 → t('deploy.jobName') + releaseManagerHelpers 4 环境标签硬编码中文移除(已有ENV_LABEL_KEY) — 新增 75 翻译键 (deploy.credType 8+credTypeDesc 8+fmtDuration 1+terminal 2+jobName 1, monitor.terminal 6+rdp 6+notify 1+prometheus 1, deploy.terminal 2, common.duration 2, system.terminalSession 4+csvHeader 7+auditExport 9+auditSettings 4+credTypeLabel 3+role 1, task.cronJob 2+terminal 1, k8s.workloadView 1, aiops.cli 5, server.import 1), zh/en 7987→8059 +72 对齐;tsc -b=0, npm build✓ (17.13s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
||||||
| U42 | i18n 残余硬编码中文彻底清零 — 全量 JSX children + toast/confirm + sr-only 描述(33 文件 54 处→0: PredictiveCapacityTab AI深度解读/紧急/警告/7天使用率预测/预计N天/后达到阈值/AI建议 + PredictiveCostTab AI深度解读 + event-handler.ts 高危操作确认 toast + DeployCredentials 启用/禁用 + DeployRBAC 删除角色 confirm + WorkspaceTermDialog 标题 + CredFormDialog Windows用户 + ClusterOverviewPage 核 + DeploymentEditContainers Pod级别 + DeploymentEditService 无selector/个关联/Ingresses应用路由/暂无Service/暂无Ingress/自动高亮 + DeploymentEditStorage 无容器 + KubectlTerminal sr-only + KubernetesClusterDialog 已配置 + ResourceVisualEditor YAML编辑 + CreateHPADialog CPU目标 + UpdateStrategyCard maxSurge/maxUnavailable/revisionHistoryLimit/progressDeadlineSeconds 说明 + IngressCreateForm host域名/Service端口 + ServiceCreateForm 端口配置/个端口/selector自动检测 + PodInstancesTable Pod名称 + UpdateStrategySelectorCards Pod管理策略 + AlertRulesTab 删除confirm/分钟 + PrometheusDatasourceManager 删除confirm + LogDatasourcePage 删除confirm + QueryHistoryPanel 条 + ServerFileBrowser sr-only + TerminalDialog sr-only + CredentialManager 删除confirm + RdpAuditViewer sr-only + SystemManager 删除用户/批量删除 confirm + TerminalSessionsTab 删除confirm + SecuritySettingsTab 30分钟/2小时 + CronJobViewDialog 次 — 新增 k8s.editAdvanced 6键+k8s.editService 11键+k8s.cluster 2键+k8s.clusterDialog 1键+k8s.kubectlTerminalDesc/k8s.rve.yamlEditBtn/k8s.hpa.cpuTarget/k8s.podLevel/k8s.podNameLabel/k8s.podManagePolicy 共 28键 + aiops.capacity 8键+aiops.cost 1键+aiops.cli 2键 + deploy.cred.windowsUser/deploy.workspaceTerminalTitle/deploy.rbac.deleteRoleDesc/deploy.cred.badgeDefault 4键 + monitor.deleteRulesConfirmDesc/deleteDatasourceConfirmDesc/deleteLogDsConfirmDesc/durationMinutes/queryHistory.count 5键 + system.rdpLiveAudit/rdpHistoryReplay/rdpAuditDesc/sshTerminalDesc/sftpFileDesc/sftpFileLabel/deleteUserConfirmDesc/batchDeleteUsersConfirmDesc/deleteCredConfirmDesc/deleteTermSessionsConfirmDesc 10键 + task.cronJob.runCount 1键 + common.minutes30/hours2 2键, zh/en 7847→7898 对齐;tsc -b=0, npm build✓ (17.71s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
| U42 | i18n 残余硬编码中文彻底清零 — 全量 JSX children + toast/confirm + sr-only 描述(33 文件 54 处→0: PredictiveCapacityTab AI深度解读/紧急/警告/7天使用率预测/预计N天/后达到阈值/AI建议 + PredictiveCostTab AI深度解读 + event-handler.ts 高危操作确认 toast + DeployCredentials 启用/禁用 + DeployRBAC 删除角色 confirm + WorkspaceTermDialog 标题 + CredFormDialog Windows用户 + ClusterOverviewPage 核 + DeploymentEditContainers Pod级别 + DeploymentEditService 无selector/个关联/Ingresses应用路由/暂无Service/暂无Ingress/自动高亮 + DeploymentEditStorage 无容器 + KubectlTerminal sr-only + KubernetesClusterDialog 已配置 + ResourceVisualEditor YAML编辑 + CreateHPADialog CPU目标 + UpdateStrategyCard maxSurge/maxUnavailable/revisionHistoryLimit/progressDeadlineSeconds 说明 + IngressCreateForm host域名/Service端口 + ServiceCreateForm 端口配置/个端口/selector自动检测 + PodInstancesTable Pod名称 + UpdateStrategySelectorCards Pod管理策略 + AlertRulesTab 删除confirm/分钟 + PrometheusDatasourceManager 删除confirm + LogDatasourcePage 删除confirm + QueryHistoryPanel 条 + ServerFileBrowser sr-only + TerminalDialog sr-only + CredentialManager 删除confirm + RdpAuditViewer sr-only + SystemManager 删除用户/批量删除 confirm + TerminalSessionsTab 删除confirm + SecuritySettingsTab 30分钟/2小时 + CronJobViewDialog 次 — 新增 k8s.editAdvanced 6键+k8s.editService 11键+k8s.cluster 2键+k8s.clusterDialog 1键+k8s.kubectlTerminalDesc/k8s.rve.yamlEditBtn/k8s.hpa.cpuTarget/k8s.podLevel/k8s.podNameLabel/k8s.podManagePolicy 共 28键 + aiops.capacity 8键+aiops.cost 1键+aiops.cli 2键 + deploy.cred.windowsUser/deploy.workspaceTerminalTitle/deploy.rbac.deleteRoleDesc/deploy.cred.badgeDefault 4键 + monitor.deleteRulesConfirmDesc/deleteDatasourceConfirmDesc/deleteLogDsConfirmDesc/durationMinutes/queryHistory.count 5键 + system.rdpLiveAudit/rdpHistoryReplay/rdpAuditDesc/sshTerminalDesc/sftpFileDesc/sftpFileLabel/deleteUserConfirmDesc/batchDeleteUsersConfirmDesc/deleteCredConfirmDesc/deleteTermSessionsConfirmDesc 10键 + task.cronJob.runCount 1键 + common.minutes30/hours2 2键, zh/en 7847→7898 对齐;tsc -b=0, npm build✓ (17.71s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
||||||
|
| U45 | AI 告警分析模块 i18n 补全(analyzerHelpers.ts 6 告警类型 × ~4 模板字符串 = 25 处硬编码中文 rootCause/impact/recommendations→i18n.t() 插值 + mapAlertEvent locale 硬编码 zh-CN→动态 i18n.language + 事件ID比较硬编码→i18n.t(defaultEvent) + AIPredictiveAnalytics 预测图标中文-only includes→match() 双语兼容 — 新增 aiops.analyzer 26 翻译键, zh/en 8059→8085 对齐;tsc -b=0, npm build✓ (17.40s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
||||||
| U37 | 全量 JSX 文本节点硬编码中文清零(65 文件 151 处→0: MiddlewareMonitor/SiteMonitor/SNMPMonitor/HealthProbeSection/ContextSwitchCard/ProcessTable/PortMonitorTab/MwTargetChartsPanel/MiddlewareDialog/ChartRangeHint/SnmpDeviceChartsPanel/AlertRulesTab/LogClusterPanel/LogDatasourcePage/LogQueryToolbar/LogAlertsPanel/PrometheusDatasourceManager/PodMetricsPage/CapacityPage/NamespaceManagementPage/NamespaceResourcePage/DeploymentEditService/EventsPage/DeploymentDetail/ClusterOverviewPage/DeploymentEditContainers/DeploymentEditStorage/WorkloadViewPage/BottomStatusBar/UpdateStrategySelectorCards/PodInstancesTable/shared-components/UpdateStrategyCard/TolerationsCard/HostSettingsCard/IngressListItem/ServiceListItem/ServiceCreateForm/IngressCreateForm/CreateHPADialog/DeployCredentials/DeployRBAC/UserGroupsManager/BuildNodesManager/DeployTargetFields/PipelineCreateDialog/CredFormDialog/WorkspaceTermDialog/AgentAlerts/AgentRuleDialog/LiveMonitorDialog/RoleFormDialog/CronJobViewDialog/TerminalOutput/AIAnalysisResult/AIPredictiveAnalytics/PredictiveCostTab/PredictiveCapacityTab/ActiveSessionsPanel/HistorySessionsPanel/TerminalDialog/ServerFileBrowser/PodFileBrowser/SiteResultsPanel/SiteProtocolPieChart — 151 JSX 文本节点中文全部替换为 t()/i18n.t() 调用;新增 common.* 98 翻译键 (selectedCount/itemsCount/newValue/namespaceLabel/containerLabel/replicasLabel/minReplicas/maxReplicas/createNamespace/noNamespace/unknownResource/exportYaml/loadTrend/loadCapacity/predicted/threshold/hostSettings/addVolume/addMount/createService/createIngress/editAction/updateStrategy/selectAndLabel/historyVersion/fileBrowser/scale/back/createHpa/allNamespaces/certLabel/observable/deviceList/addDevice/addMonitor/collectNow/addTask/addProbe/restoreFull/contextSwitch/processTop/listenPorts/terminalRealtime/auditWebssh/buildTerminal/fileBrowse/newDir/loadDeployment/notLinked/selectedPerms/none/hasLabel/deleteNamespace/deleteNamespaceWarn/allResources/notFoundDeploy/nodeList/fileLabel/addCustom/newInstanceService/newInstanceIngress/totalContainers/workContainers/loadingEllipsis/volumeClaimTemplates/containerTemplate/passwordOptional/updated/page/perPage/clusterMode/totalLogs/countLabel/percentage/queryTime/addDatasource/newPermission/newEnv/envLabel/displayName/newUserGroup/auditTrace/predictValue/confidence/predictMonthEnd/noCapacityData/securityMode/standardRdp/domainLabel/noRdpActive/noRdpHistory/buffer/matched/podLogs/createHpaTitle/password/events/total);37 文件已有 import i18n→i18n.t() 模式, 2 文件新增 import i18n;zh/en 7640→3526 namespace-flat +98 键对齐;tsc -b=0, npm build✓ (17.96s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
| U37 | 全量 JSX 文本节点硬编码中文清零(65 文件 151 处→0: MiddlewareMonitor/SiteMonitor/SNMPMonitor/HealthProbeSection/ContextSwitchCard/ProcessTable/PortMonitorTab/MwTargetChartsPanel/MiddlewareDialog/ChartRangeHint/SnmpDeviceChartsPanel/AlertRulesTab/LogClusterPanel/LogDatasourcePage/LogQueryToolbar/LogAlertsPanel/PrometheusDatasourceManager/PodMetricsPage/CapacityPage/NamespaceManagementPage/NamespaceResourcePage/DeploymentEditService/EventsPage/DeploymentDetail/ClusterOverviewPage/DeploymentEditContainers/DeploymentEditStorage/WorkloadViewPage/BottomStatusBar/UpdateStrategySelectorCards/PodInstancesTable/shared-components/UpdateStrategyCard/TolerationsCard/HostSettingsCard/IngressListItem/ServiceListItem/ServiceCreateForm/IngressCreateForm/CreateHPADialog/DeployCredentials/DeployRBAC/UserGroupsManager/BuildNodesManager/DeployTargetFields/PipelineCreateDialog/CredFormDialog/WorkspaceTermDialog/AgentAlerts/AgentRuleDialog/LiveMonitorDialog/RoleFormDialog/CronJobViewDialog/TerminalOutput/AIAnalysisResult/AIPredictiveAnalytics/PredictiveCostTab/PredictiveCapacityTab/ActiveSessionsPanel/HistorySessionsPanel/TerminalDialog/ServerFileBrowser/PodFileBrowser/SiteResultsPanel/SiteProtocolPieChart — 151 JSX 文本节点中文全部替换为 t()/i18n.t() 调用;新增 common.* 98 翻译键 (selectedCount/itemsCount/newValue/namespaceLabel/containerLabel/replicasLabel/minReplicas/maxReplicas/createNamespace/noNamespace/unknownResource/exportYaml/loadTrend/loadCapacity/predicted/threshold/hostSettings/addVolume/addMount/createService/createIngress/editAction/updateStrategy/selectAndLabel/historyVersion/fileBrowser/scale/back/createHpa/allNamespaces/certLabel/observable/deviceList/addDevice/addMonitor/collectNow/addTask/addProbe/restoreFull/contextSwitch/processTop/listenPorts/terminalRealtime/auditWebssh/buildTerminal/fileBrowse/newDir/loadDeployment/notLinked/selectedPerms/none/hasLabel/deleteNamespace/deleteNamespaceWarn/allResources/notFoundDeploy/nodeList/fileLabel/addCustom/newInstanceService/newInstanceIngress/totalContainers/workContainers/loadingEllipsis/volumeClaimTemplates/containerTemplate/passwordOptional/updated/page/perPage/clusterMode/totalLogs/countLabel/percentage/queryTime/addDatasource/newPermission/newEnv/envLabel/displayName/newUserGroup/auditTrace/predictValue/confidence/predictMonthEnd/noCapacityData/securityMode/standardRdp/domainLabel/noRdpActive/noRdpHistory/buffer/matched/podLogs/createHpaTitle/password/events/total);37 文件已有 import i18n→i18n.t() 模式, 2 文件新增 import i18n;zh/en 7640→3526 namespace-flat +98 键对齐;tsc -b=0, npm build✓ (17.96s), ESLint=0/43/any=0, go build=0, 17/17 测试通过) | P3 | **done** |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -198,10 +198,10 @@ export function AIPredictiveAnalytics() {
|
|||||||
<div key={idx} className="p-4 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)]/50">
|
<div key={idx} className="p-4 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)]/50">
|
||||||
<div className="flex items-center justify-between mb-3">
|
<div className="flex items-center justify-between mb-3">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{prediction.name.includes('CPU') && <Cpu className="h-4 w-4 dg-text-blue" />}
|
{(prediction.name.match(/CPU|cpu/i)) && <Cpu className="h-4 w-4 dg-text-blue" />}
|
||||||
{prediction.name.includes('内存') && <MemoryStick className="h-4 w-4 dg-text-green" />}
|
{(prediction.name.match(/memory|mem|内存/i)) && <MemoryStick className="h-4 w-4 dg-text-green" />}
|
||||||
{prediction.name.includes('磁盘') && <HardDrive className="h-4 w-4 dg-text-yellow" />}
|
{(prediction.name.match(/disk|磁盘/i)) && <HardDrive className="h-4 w-4 dg-text-yellow" />}
|
||||||
{prediction.name.includes('网络') && <Network className="h-4 w-4 dg-text-purple" />}
|
{(prediction.name.match(/network|网络/i)) && <Network className="h-4 w-4 dg-text-purple" />}
|
||||||
<span className="font-medium text-[var(--dg-text-primary)]">{prediction.name}</span>
|
<span className="font-medium text-[var(--dg-text-primary)]">{prediction.name}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ export function generateAIAnalysis(alert: AlertItem): AIAnalysis {
|
|||||||
// CPU 告警
|
// CPU 告警
|
||||||
if (metric.includes('cpu')) {
|
if (metric.includes('cpu')) {
|
||||||
return {
|
return {
|
||||||
rootCause: `检测到 ${target} 上 CPU 使用率达到 ${alert.currentValue},持续超过阈值 ${alert.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,
|
rootCause: i18n.t('aiops.analyzer.cpuRootCause', { target, value: alert.currentValue, threshold: alert.threshold }),
|
||||||
impact: isCritical
|
impact: isCritical
|
||||||
? `CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。`
|
? i18n.t('aiops.analyzer.cpuImpactCritical')
|
||||||
: `CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。`,
|
: i18n.t('aiops.analyzer.cpuImpactWarning'),
|
||||||
recommendations: [
|
recommendations: [
|
||||||
`登录 ${target} 执行 top/htop 定位高 CPU 进程`,
|
i18n.t('aiops.analyzer.cpuRecLogin', { target }),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
`考虑临时扩容或将部分流量调度到其他节点`,
|
i18n.t('aiops.analyzer.cpuRecScale'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
],
|
],
|
||||||
autoFixScript: `#!/bin/bash\n# CPU 高负载诊断脚本 - ${target}\necho "${i18n.t('aiops.analysis.topCpuProcess')}"\nps aux --sort=-%cpu | head -11\necho ""\necho "${i18n.t('aiops.analyzerHelpers.systemLoad')}"\nuptime\necho ""\necho "${i18n.t('aiops.analyzerHelpers.highCpuProcessDetail')}"\nPID=$(ps aux --sort=-%cpu | sed -n '2p' | awk '{print $2}')\nif [ -n "$PID" ]; then\n echo "${i18n.t('aiops.analyzerHelpers.topCpuProcess')}"\n cat /proc/$PID/cmdline | tr '\\0' ' '\n echo ""\nfi\n`,
|
autoFixScript: `#!/bin/bash\n# CPU 高负载诊断脚本 - ${target}\necho "${i18n.t('aiops.analysis.topCpuProcess')}"\nps aux --sort=-%cpu | head -11\necho ""\necho "${i18n.t('aiops.analyzerHelpers.systemLoad')}"\nuptime\necho ""\necho "${i18n.t('aiops.analyzerHelpers.highCpuProcessDetail')}"\nPID=$(ps aux --sort=-%cpu | sed -n '2p' | awk '{print $2}')\nif [ -n "$PID" ]; then\n echo "${i18n.t('aiops.analyzerHelpers.topCpuProcess')}"\n cat /proc/$PID/cmdline | tr '\\0' ' '\n echo ""\nfi\n`,
|
||||||
@@ -62,12 +62,12 @@ export function generateAIAnalysis(alert: AlertItem): AIAnalysis {
|
|||||||
// 内存告警
|
// 内存告警
|
||||||
if (metric.includes('mem') || metric.includes('ram')) {
|
if (metric.includes('mem') || metric.includes('ram')) {
|
||||||
return {
|
return {
|
||||||
rootCause: `检测到 ${target} 内存使用率达到 ${alert.currentValue},接近或超过阈值 ${alert.threshold}。常见原因:1) 应用内存泄漏,对象未被正确释放;2) 缓存配置过大;3) 数据库连接池未及时释放。`,
|
rootCause: i18n.t('aiops.analyzer.memRootCause', { target, value: alert.currentValue, threshold: alert.threshold }),
|
||||||
impact: isCritical
|
impact: isCritical
|
||||||
? `内存即将耗尽可能触发 OOM Killer,导致关键进程被强制终止,服务中断风险极高。`
|
? i18n.t('aiops.analyzer.memImpactCritical')
|
||||||
: `内存持续增长,长期可能导致 OOM,建议尽快排查内存使用情况。`,
|
: i18n.t('aiops.analyzer.memImpactWarning'),
|
||||||
recommendations: [
|
recommendations: [
|
||||||
`检查 ${target} 上的内存占用最高的进程`,
|
i18n.t('aiops.analyzer.memRecCheck', { target }),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
@@ -80,12 +80,12 @@ export function generateAIAnalysis(alert: AlertItem): AIAnalysis {
|
|||||||
// 磁盘告警
|
// 磁盘告警
|
||||||
if (metric.includes('disk') || metric.includes('space')) {
|
if (metric.includes('disk') || metric.includes('space')) {
|
||||||
return {
|
return {
|
||||||
rootCause: `检测到 ${target} 磁盘使用率达到 ${alert.currentValue},超过阈值 ${alert.threshold}。最常见原因:1) 日志文件未配置轮转/清理;2) 临时文件堆积;3) 数据库数据文件膨胀。`,
|
rootCause: i18n.t('aiops.analyzer.diskRootCause', { target, value: alert.currentValue, threshold: alert.threshold }),
|
||||||
impact: isCritical
|
impact: isCritical
|
||||||
? `磁盘空间不足可能导致服务无法写入数据/日志,数据库可能崩溃,文件系统变只读,影响范围极大。`
|
? i18n.t('aiops.analyzer.diskImpactCritical')
|
||||||
: `磁盘空间告警,如不及时清理可能导致服务异常。`,
|
: i18n.t('aiops.analyzer.diskImpactWarning'),
|
||||||
recommendations: [
|
recommendations: [
|
||||||
`清理 ${target} 上 30 天前的日志文件`,
|
i18n.t('aiops.analyzer.diskRecClean', { target }),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
@@ -99,12 +99,12 @@ export function generateAIAnalysis(alert: AlertItem): AIAnalysis {
|
|||||||
// 网络告警
|
// 网络告警
|
||||||
if (metric.includes('net') || metric.includes('latency') || metric.includes('bandwidth')) {
|
if (metric.includes('net') || metric.includes('latency') || metric.includes('bandwidth')) {
|
||||||
return {
|
return {
|
||||||
rootCause: `检测到 ${target} 网络指标异常(当前值 ${alert.currentValue}),可能原因:1) 上游依赖服务响应变慢;2) 网络带宽打满;3) DNS 解析延迟;4) 连接数达到上限。`,
|
rootCause: i18n.t('aiops.analyzer.netRootCause', { target, value: alert.currentValue }),
|
||||||
impact: isCritical
|
impact: isCritical
|
||||||
? `网络异常将导致所有经过该节点的请求超时,影响所有上游业务的可用性。`
|
? i18n.t('aiops.analyzer.netImpactCritical')
|
||||||
: `网络延迟偏高,可能影响用户体验,建议排查网络链路。`,
|
: i18n.t('aiops.analyzer.netImpactWarning'),
|
||||||
recommendations: [
|
recommendations: [
|
||||||
`检查 ${target} 的网络连接和带宽使用情况`,
|
i18n.t('aiops.analyzer.netRecCheck', { target }),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
@@ -117,12 +117,12 @@ export function generateAIAnalysis(alert: AlertItem): AIAnalysis {
|
|||||||
// 服务可用性告警
|
// 服务可用性告警
|
||||||
if (metric.includes('service') || metric.includes('up') || metric.includes('avail')) {
|
if (metric.includes('service') || metric.includes('up') || metric.includes('avail')) {
|
||||||
return {
|
return {
|
||||||
rootCause: `检测到 ${target} 服务不可用(指标 ${alert.metric} = ${alert.currentValue})。可能原因:1) 进程崩溃或被 OOM Killer 终止;2) 端口被占用或监听异常;3) 健康检查端点返回错误;4) 配置文件错误导致启动失败。`,
|
rootCause: i18n.t('aiops.analyzer.serviceRootCause', { target, metric: alert.metric, value: alert.currentValue }),
|
||||||
impact: isCritical
|
impact: isCritical
|
||||||
? `服务完全不可用,所有依赖该服务的业务功能将中断,需要立即处理。`
|
? i18n.t('aiops.analyzer.serviceImpactCritical')
|
||||||
: `服务可用性下降,部分功能可能受影响。`,
|
: i18n.t('aiops.analyzer.serviceImpactWarning'),
|
||||||
recommendations: [
|
recommendations: [
|
||||||
`立即检查 ${target} 的服务状态: systemctl status <service>`,
|
i18n.t('aiops.analyzer.serviceRecCheck', { target }),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
i18n.t('aiops.analysis.checkAbnormalTasks'),
|
||||||
@@ -135,12 +135,12 @@ export function generateAIAnalysis(alert: AlertItem): AIAnalysis {
|
|||||||
|
|
||||||
// 默认/通用分析
|
// 默认/通用分析
|
||||||
return {
|
return {
|
||||||
rootCause: `检测到 ${target} 触发告警「${alert.name}」,当前指标值 ${alert.currentValue} 超过阈值 ${alert.threshold}。建议进一步排查具体指标数据和相关日志以确定根因。`,
|
rootCause: i18n.t('aiops.analyzer.defaultRootCause', { target, name: alert.name, value: alert.currentValue, threshold: alert.threshold }),
|
||||||
impact: isCritical
|
impact: isCritical
|
||||||
? `该告警级别为严重,可能影响业务正常运行,建议优先处理。`
|
? i18n.t('aiops.analyzer.defaultImpactCritical')
|
||||||
: `该告警需要关注,持续恶化可能影响系统稳定性。`,
|
: i18n.t('aiops.analyzer.defaultImpactWarning'),
|
||||||
recommendations: [
|
recommendations: [
|
||||||
`查看 ${target} 的监控仪表盘,确认指标趋势`,
|
i18n.t('aiops.analyzer.defaultRecDashboard', { target }),
|
||||||
i18n.t('aiops.analysis.checkSystemLogs'),
|
i18n.t('aiops.analysis.checkSystemLogs'),
|
||||||
i18n.t('aiops.analysis.checkSystemLogs'),
|
i18n.t('aiops.analysis.checkSystemLogs'),
|
||||||
i18n.t('aiops.analysis.checkSystemLogs'),
|
i18n.t('aiops.analysis.checkSystemLogs'),
|
||||||
@@ -169,7 +169,8 @@ export function mapAlertEvent(event: JsonData): AlertItem {
|
|||||||
const diffMin = Math.max(1, Math.round((endTime.getTime() - startTime.getTime()) / 60000));
|
const diffMin = Math.max(1, Math.round((endTime.getTime() - startTime.getTime()) / 60000));
|
||||||
const duration = diffMin >= 60 ? i18n.t('aiops.durationHM', { hours: Math.floor(diffMin / 60), mins: diffMin % 60 }) : i18n.t('aiops.durationM', { mins: diffMin });
|
const duration = diffMin >= 60 ? i18n.t('aiops.durationHM', { hours: Math.floor(diffMin / 60), mins: diffMin % 60 }) : i18n.t('aiops.durationM', { mins: diffMin });
|
||||||
|
|
||||||
const startedAt = startTime.toLocaleString('zh-CN', { hour12: false });
|
const locale = i18n.language || 'zh-CN';
|
||||||
|
const startedAt = startTime.toLocaleString(locale, { hour12: false });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: String(event.id),
|
id: String(event.id),
|
||||||
@@ -182,7 +183,7 @@ export function mapAlertEvent(event: JsonData): AlertItem {
|
|||||||
currentValue,
|
currentValue,
|
||||||
duration,
|
duration,
|
||||||
startedAt,
|
startedAt,
|
||||||
description: event.message && event.message !== `告警事件 ${event.id}`
|
description: event.message && event.message !== i18n.t('aiops.analyzer.defaultEvent', { id: event.id })
|
||||||
? event.message
|
? event.message
|
||||||
: event.rule?.description || `${event.rule_name || i18n.t('monitor.hostDashboard.alert')}: ${event.target} ${i18n.t('common.currentValue')} ${currentValue}`,
|
: event.rule?.description || `${event.rule_name || i18n.t('monitor.hostDashboard.alert')}: ${event.target} ${i18n.t('common.currentValue')} ${currentValue}`,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8728,6 +8728,34 @@
|
|||||||
"reachable": "reachable",
|
"reachable": "reachable",
|
||||||
"cost": {
|
"cost": {
|
||||||
"aiInsight": "AI Deep Insight"
|
"aiInsight": "AI Deep Insight"
|
||||||
|
},
|
||||||
|
"analyzer": {
|
||||||
|
"cpuRootCause": "Detected CPU usage on {{target}} reached {{value}}, exceeding threshold {{threshold}}. Possible causes: 1) A process has an infinite loop or high computational load; 2) Frequent GC triggers (Java/Go apps); 3) Sudden traffic surge exceeding processing capacity.",
|
||||||
|
"cpuImpactCritical": "Sustained high CPU load will significantly increase service response latency, potentially triggering cascading failures affecting all services dependent on this node.",
|
||||||
|
"cpuImpactWarning": "CPU usage is elevated, which may slow down some request processing. Investigate promptly to prevent further degradation.",
|
||||||
|
"cpuRecLogin": "Log in to {{target}} and run top/htop to identify high-CPU processes",
|
||||||
|
"cpuRecScale": "Consider temporary scaling out or diverting traffic to other nodes",
|
||||||
|
"memRootCause": "Detected memory usage on {{target}} reached {{value}}, approaching or exceeding threshold {{threshold}}. Common causes: 1) Application memory leak, objects not properly released; 2) Cache configured too large; 3) Database connection pool not released in time.",
|
||||||
|
"memImpactCritical": "Memory exhaustion may trigger OOM Killer, forcibly terminating critical processes with extremely high service disruption risk.",
|
||||||
|
"memImpactWarning": "Memory continues to grow, may cause OOM in the long term. Investigate memory usage as soon as possible.",
|
||||||
|
"memRecCheck": "Check the highest memory-consuming processes on {{target}}",
|
||||||
|
"diskRootCause": "Detected disk usage on {{target}} reached {{value}}, exceeding threshold {{threshold}}. Most common causes: 1) Log files without rotation/cleanup configured; 2) Temporary file accumulation; 3) Database data file bloat.",
|
||||||
|
"diskImpactCritical": "Insufficient disk space may prevent services from writing data/logs, database may crash, filesystem may become read-only, with widespread impact.",
|
||||||
|
"diskImpactWarning": "Disk space alert. Failure to clean up promptly may cause service anomalies.",
|
||||||
|
"diskRecClean": "Clean up log files older than 30 days on {{target}}",
|
||||||
|
"netRootCause": "Detected network metric anomaly on {{target}} (current value {{value}}). Possible causes: 1) Upstream dependency services responding slowly; 2) Network bandwidth saturated; 3) DNS resolution latency; 4) Connection limit reached.",
|
||||||
|
"netImpactCritical": "Network anomalies will cause all requests through this node to time out, affecting availability of all upstream services.",
|
||||||
|
"netImpactWarning": "Network latency is elevated, may affect user experience. Investigate the network path.",
|
||||||
|
"netRecCheck": "Check network connections and bandwidth usage on {{target}}",
|
||||||
|
"serviceRootCause": "Detected service unavailable on {{target}} (metric {{metric}} = {{value}}). Possible causes: 1) Process crashed or killed by OOM Killer; 2) Port occupied or listening abnormally; 3) Health check endpoint returning errors; 4) Configuration errors causing startup failure.",
|
||||||
|
"serviceImpactCritical": "Service is completely unavailable. All business functions dependent on this service will be disrupted. Immediate action required.",
|
||||||
|
"serviceImpactWarning": "Service availability degraded. Some functions may be affected.",
|
||||||
|
"serviceRecCheck": "Immediately check service status on {{target}}: systemctl status <service>",
|
||||||
|
"defaultRootCause": "Detected alert triggered on {{target}}: \"{{name}}\", current metric value {{value}} exceeds threshold {{threshold}}. Further investigation of specific metric data and related logs is recommended to determine root cause.",
|
||||||
|
"defaultImpactCritical": "This alert severity is critical and may affect normal business operations. Prioritized handling is recommended.",
|
||||||
|
"defaultImpactWarning": "This alert requires attention. Continued deterioration may affect system stability.",
|
||||||
|
"defaultRecDashboard": "Check the monitoring dashboard for {{target}} to confirm metric trends",
|
||||||
|
"defaultEvent": "Alert event {{id}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"breadcrumb": {
|
"breadcrumb": {
|
||||||
|
|||||||
@@ -8728,6 +8728,34 @@
|
|||||||
"reachable": "可达",
|
"reachable": "可达",
|
||||||
"cost": {
|
"cost": {
|
||||||
"aiInsight": "AI 深度解读"
|
"aiInsight": "AI 深度解读"
|
||||||
|
},
|
||||||
|
"analyzer": {
|
||||||
|
"cpuRootCause": "检测到 {{target}} 上 CPU 使用率达到 {{value}},持续超过阈值 {{threshold}}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。",
|
||||||
|
"cpuImpactCritical": "CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。",
|
||||||
|
"cpuImpactWarning": "CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",
|
||||||
|
"cpuRecLogin": "登录 {{target}} 执行 top/htop 定位高 CPU 进程",
|
||||||
|
"cpuRecScale": "考虑临时扩容或将部分流量调度到其他节点",
|
||||||
|
"memRootCause": "检测到 {{target}} 内存使用率达到 {{value}},接近或超过阈值 {{threshold}}。常见原因:1) 应用内存泄漏,对象未被正确释放;2) 缓存配置过大;3) 数据库连接池未及时释放。",
|
||||||
|
"memImpactCritical": "内存即将耗尽可能触发 OOM Killer,导致关键进程被强制终止,服务中断风险极高。",
|
||||||
|
"memImpactWarning": "内存持续增长,长期可能导致 OOM,建议尽快排查内存使用情况。",
|
||||||
|
"memRecCheck": "检查 {{target}} 上的内存占用最高的进程",
|
||||||
|
"diskRootCause": "检测到 {{target}} 磁盘使用率达到 {{value}},超过阈值 {{threshold}}。最常见原因:1) 日志文件未配置轮转/清理;2) 临时文件堆积;3) 数据库数据文件膨胀。",
|
||||||
|
"diskImpactCritical": "磁盘空间不足可能导致服务无法写入数据/日志,数据库可能崩溃,文件系统变只读,影响范围极大。",
|
||||||
|
"diskImpactWarning": "磁盘空间告警,如不及时清理可能导致服务异常。",
|
||||||
|
"diskRecClean": "清理 {{target}} 上 30 天前的日志文件",
|
||||||
|
"netRootCause": "检测到 {{target}} 网络指标异常(当前值 {{value}}),可能原因:1) 上游依赖服务响应变慢;2) 网络带宽打满;3) DNS 解析延迟;4) 连接数达到上限。",
|
||||||
|
"netImpactCritical": "网络异常将导致所有经过该节点的请求超时,影响所有上游业务的可用性。",
|
||||||
|
"netImpactWarning": "网络延迟偏高,可能影响用户体验,建议排查网络链路。",
|
||||||
|
"netRecCheck": "检查 {{target}} 的网络连接和带宽使用情况",
|
||||||
|
"serviceRootCause": "检测到 {{target}} 服务不可用(指标 {{metric}} = {{value}})。可能原因:1) 进程崩溃或被 OOM Killer 终止;2) 端口被占用或监听异常;3) 健康检查端点返回错误;4) 配置文件错误导致启动失败。",
|
||||||
|
"serviceImpactCritical": "服务完全不可用,所有依赖该服务的业务功能将中断,需要立即处理。",
|
||||||
|
"serviceImpactWarning": "服务可用性下降,部分功能可能受影响。",
|
||||||
|
"serviceRecCheck": "立即检查 {{target}} 的服务状态: systemctl status <service>",
|
||||||
|
"defaultRootCause": "检测到 {{target}} 触发告警「{{name}}」,当前指标值 {{value}} 超过阈值 {{threshold}}。建议进一步排查具体指标数据和相关日志以确定根因。",
|
||||||
|
"defaultImpactCritical": "该告警级别为严重,可能影响业务正常运行,建议优先处理。",
|
||||||
|
"defaultImpactWarning": "该告警需要关注,持续恶化可能影响系统稳定性。",
|
||||||
|
"defaultRecDashboard": "查看 {{target}} 的监控仪表盘,确认指标趋势",
|
||||||
|
"defaultEvent": "告警事件 {{id}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"breadcrumb": {
|
"breadcrumb": {
|
||||||
|
|||||||
Reference in new issue
Block a user