feat: 监控告警体系统一重构 + 自动化任务调度引擎 + 监控大屏拆分

告警中心
- 新增统一告警(alert_unified)、监控告警规则(monitor_alert_rule)、指标目录(alert_metric_catalog)
- 通知策略与消息分发(alert_notify_policy/dispatch/message)、静默规则
- 告警引擎按阈值/SNMP 拆分(alert_engine_monitor/snmp)

监控采集
- SNMP 常量/模板与历史指标(snmp templates/constants、snmp_metrics_history、snmp_collect)
- 中间件监控 Redis 采集与种子(middleware_monitor_redis/seed)
- 站点探测 pkg(siteprobe) + 站点视图(site_view)

自动化任务
- cron 调度器(cronscheduler)、脚本运行器(scriptrunner)、系统任务(systask)及运行记录(cron_job_run、system_task)

审计与凭证
- 审计设置(audit_setting) + 历史清理(auditcleaner)

前端
- 监控页面(host/middleware/site/snmp)拆分为子模块并大屏化
- 告警中心多 Tab(规则/指标目录/通知策略/静默)、任务管理组件重构、Agent CLI Markdown 渲染
- 移除旧脚本卡片/详情/日志组件,统一为 ScriptTable/ScriptCodeEditor/TerminalOutput

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
LoganandClaude committed 2026-07-01 23:44:45 +08:00
1 parent 092d0e4b9e
commit 471353e3d7
190 files changed
+16640 -3484

No files matched your search

@@ -25,11 +25,20 @@ import type { JsonData } from '@/types/common';
// 定时任务类型定义 // Logan.Li
const jobTypes = [
{ value: 'shell', label: 'Shell 脚本', desc: '关联脚本库中的 Shell 脚本' },
{ value: 'python', label: 'Python 脚本', desc: '关联脚本库中的 Python 脚本' },
{ value: 'command', label: '自定义命令', desc: '手动输入命令或脚本路径' },
{ value: 'shell', label: 'Shell', desc: '关联脚本库中的 Shell 脚本' },
{ value: 'python', label: 'Python', desc: '关联脚本库中的 Python 脚本' },
{ value: 'powershell', label: 'PowerShell', desc: '关联脚本库中的 PowerShell 脚本' },
{ value: 'command', label: '自定义命令', desc: '手动输入命令或脚本路径' },
];
const scriptJobTypes = ['shell', 'python', 'powershell'];
function scriptTypeLabel(type: string) {
if (type === 'python') return 'Python';
if (type === 'powershell') return 'PowerShell';
return 'Shell';
}
export function CronJobFormDialog({
open,
onOpenChange,
@@ -84,8 +93,8 @@ export function CronJobFormDialog({
}
}, [open, editJob]);
// 按类型过滤脚本库
const filteredScripts = form.type === 'shell' || form.type === 'python'
// 按类型过滤脚本库 // Logan.Li
const filteredScripts = scriptJobTypes.includes(form.type)
? scripts.filter(s => s.type === form.type)
: [];
@@ -114,8 +123,8 @@ export function CronJobFormDialog({
toast.error('请填写任务名称和 Cron 表达式');
return;
}
// shell/python 类型必须选脚本
if ((form.type === 'shell' || form.type === 'python') && !form.script_id) {
// 脚本类型必须选关联脚本 // Logan.Li
if (scriptJobTypes.includes(form.type) && !form.script_id) {
toast.error('请选择关联的脚本');
return;
}
@@ -206,7 +215,7 @@ export function CronJobFormDialog({
{/* 执行类型 */}
<div>
<Label className="text-[var(--dg-text-primary)]">执行类型</Label>
<div className="grid grid-cols-3 gap-2 mt-1">
<div className="grid grid-cols-2 sm:grid-cols-4 gap-2 mt-1">
{jobTypes.map(t => (
<button
key={t.value}
@@ -227,8 +236,8 @@ export function CronJobFormDialog({
</p>
</div>
{/* 脚本选择 (shell/python) 或 命令输入 (command) */}
{form.type === 'shell' || form.type === 'python' ? (
{/* 脚本选择 (shell/python/powershell) 或 命令输入 (command) */}
{scriptJobTypes.includes(form.type) ? (
<div className="space-y-3">
<div>
<Label className="text-[var(--dg-text-primary)]">
@@ -237,10 +246,10 @@ export function CronJobFormDialog({
{filteredScripts.length === 0 ? (
<div className="mt-1 px-3 py-4 rounded-md border border-dashed border-[var(--dg-border)] text-center">
<p className="text-sm text-[var(--dg-text-muted)]">
脚本库中没有 {form.type === 'shell' ? 'Shell' : 'Python'} 脚本
脚本库中没有 {scriptTypeLabel(form.type)} 脚本
</p>
<p className="text-xs text-[var(--dg-text-muted)] mt-1">
请先到「脚本库」创建 {form.type === 'shell' ? 'Shell' : 'Python'} 脚本
请先到「脚本库」创建 {scriptTypeLabel(form.type)} 脚本
</p>
</div>
) : (
@@ -267,7 +276,7 @@ export function CronJobFormDialog({
<div>
<div className="flex items-center gap-2 mb-1">
<Badge variant="outline" className="border-[var(--dg-border)] text-[var(--dg-text-muted)]">
{selectedScript.type === 'shell' ? 'Shell' : 'Python'}
{scriptTypeLabel(selectedScript.type || form.type)}
</Badge>
<span className="text-xs text-[var(--dg-text-muted)]">
{(selectedScript.content || '').split('\n').length} 行