with one click
n9e-create-dashboard
创建监控仪表盘。当用户要求创建仪表盘、监控大盘、Dashboard 时使用。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
创建监控仪表盘。当用户要求创建仪表盘、监控大盘、Dashboard 时使用。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
**创建告警规则**。优先复用 integrations 里验证过的规则(标准组件 Linux/MySQL/Redis/Kafka/PostgreSQL/Elasticsearch 等都有现成规则包),导入几条按用户需求来——单条、一批、或整套都行;integration 里没有贴合的规则时再手写自定义规则。支持 Prometheus / Loki / ES / OpenSearch / MySQL / PG / TDengine / ClickHouse / Doris / VictoriaLogs / Host 全部数据源。 ⚠️ **不要用这个 skill 做批量 YAML 导入**——用户给的是 URL 或 YAML 文件、awesome-prometheus-alerts、node-exporter.yml 之类,请改用 n9e-import-prom-rule。 触发:创建一条/加一条告警 / 帮我建个 CPU 告警 / 给 MySQL 加套告警规则 / 给主机配上常用告警 / 我要监控某个指标。
夜莺(n9e)告警屏蔽规则(alert_mute)的创建、编辑、排障一站式助手。当用户要求"创建屏蔽规则 / 屏蔽告警 / 静默告警 / 维护窗口免打扰 / 周期性屏蔽 / 每天凌晨屏蔽 / 调整或延长屏蔽 / 屏蔽不生效排查"时使用。屏蔽作用于事件评估阶段(被屏蔽的事件不落库不通知);要配"哪些事件通知给谁"用通知规则(→ n9e-notify-rule-copilot),要查"为什么没收到通知"走告警排障(→ n9e-alert-rule-troubleshoot)。
夜莺(n9e)告警订阅规则(alert_subscribe)的创建、编辑、排障一站式助手。当用户要求"创建订阅规则 / 订阅告警 / 告警事件转发 / 抄送另一个团队 / 告警升级(持续 N 分钟未处理再通知谁)/ 跨业务组收告警 / 订阅不生效排查"时使用。订阅是通知阶段对事件的"复制+二次路由";要配"事件直接通知给谁"用通知规则(→ n9e-notify-rule-copilot),要不收告警用屏蔽(→ n9e-alert-mute-copilot)。
夜莺(n9e)通知规则(notify_rule)的创建、编辑、复制、排障一站式助手。当用户要求"创建通知规则 / 添加通知策略 / 配置告警通知方式 / 编辑调整通知规则 / 分级通知 / 按业务组或标签路由 / 工作时间与非工作时间不同动作 / 恢复时不打电话 / 修复规则匹配不上"时使用——尤其擅长把自然语言路由需求拆成正确的 NotifyConfig 数组。本技能专注通知规则的路由层:不动通知媒介本身(→ n9e-notify-channel-copilot),不动消息模板(→ n9e-generate-message-template),不查"为什么没发出"(→ n9e-alert-rule-troubleshoot 流程 B)。
**批量导入 Prometheus 告警规则 YAML 文件**(一次性建一组规则)。专用于处理远端 URL 或本地 YAML 文本,自动解析 `groups` / 纯 `rules` 数组 / 单条 rule 三种格式。 ⚠️ **不要用这个 skill 做单条创建**——用户用自然语言描述一条告警需求时,请改用 n9e-create-alert-rule。 触发:导入 / import / 批量 / URL / .yml 文件 / .yaml 文件 / awesome-prometheus-alerts / node-exporter.yml / prometheus rule file。
This skill should be used when the user reports that an alert rule is "not firing", "没发告警", "告警不触发", "规则没生效", "应该报警但没报警", "为什么没收到告警", "alert rule not firing", or wants to diagnose why a specific alert rule failed to produce an event/notification. 适用于排查"告警规则为什么没正常发出告警",而不是看已有告警找根因(后者用 ops-troubleshooting)。仅支持 Release 22 及以上版本。
| name | n9e-create-dashboard |
| description | 创建监控仪表盘。当用户要求创建仪表盘、监控大盘、Dashboard 时使用。 |
| max_iterations | 18 |
| builtin_tools | ["import_dashboard_template","create_dashboard","list_metrics","list_files","read_file","grep_files"] |
| tags | ["export"] |
创建仪表盘有两条路径,优先用方式 A(导入集成模板),模板是人工精调验证过的成品,质量远高于手工拼装;只有在没有现成模板或用户要自定义指标时才走方式 B。
同一组件常同时有 categraf 和 exporter 两套模板时,优先 categraf:先探测 categraf 指标有没有数据,能查到就用 categraf 模板,查不到才退回 exporter(详见方式 A 第 3 步)。
| 场景 | 用哪个工具 |
|---|---|
| 监控主题在 integrations 里有现成模板(Linux / MySQL / Redis / Kafka / PostgreSQL / Elasticsearch / Ceph / Oracle / Nginx / Windows …) | import_dashboard_template(首选) |
| 自定义指标、没有现成模板、或用户明确要求自定义面板 | create_dashboard |
list_busi_groups 获取业务组列表list_datasources 获取数据源列表,找到 Prometheus 类型的数据源 IDbusi_group_id / datasource_id,直接用,不要再调 list_*is_default: true 的业务组(通常是 "Default Busi Group" 或含"默认"的组)
b. 只有一个业务组时直接用
c. 多个候选且都非默认时,不要盲取第一个,在回复里列出让用户确认import_dashboard_template 会读取 integrations/ 下的完整模板(布局、阈值、单位、overrides、value mappings 全部保留),并自动把模板的数据源绑定改写到你选的 Prometheus 数据源上。
list_files(base="integrations")
list_files(base="integrations/Linux", path="dashboards")
node_* / *_exporter 风格指标名)两种采集风格,文件名约定各组件不一,可能是前缀(Linux 的 categraf-overview.json)也可能是后缀(redis_by_categraf.json)。优先选文件名含 categraf 的模板:
list_metrics(datasource_id=<X>, keyword="<categraf 指标关键字>")。
cpu_usage(categraf 是 cpu_usage_idle,node_exporter 没有这个名字)、mem_used_percent、disk_used_percent;Redis 用 redis_used_memory。read_file(base="integrations/Linux", path="metrics/categraf-base.json"),从里面挑一个代表性 expression 去探测。categraf 的模板,不必再去比较 exporter。exporter 的模板(如 exporter-detail.json、redis_by_exporter.json),并用对应的 exporter 指标关键字(如 node_cpu_seconds_total)list_metrics 确认它确实有数据后再导入。read_file 把整个 dashboard 模板读出来再拼——模板可能很大且会被截断;挑文件靠文件名 + metrics 清单即可import_dashboard_template(group_id=<业务组>, component="Linux", file="categraf-overview.json", datasource_id=<Prometheus数据源>)
component + filedatasource_id 可选:传了就把它设为大盘数据源变量的默认选中值(首屏即可查询);不传则由前端在数据源下拉里自动选第一个 Prometheusname / tags,不传则沿用模板自带的Name duplicate 时,不要调 list_dashboards,直接换个名字(加 -v2、-AI 或时间戳后缀)重试用 create_dashboard。只需提供面板标题、类型和 PromQL,工具自动生成完整配置(布局、数据源变量、样式、单位等全部自动处理)。
create_dashboard 接受的是下面这套简化字段。除此之外的字段(thresholds、overrides、value mappings、heatmap/hexbin/tableNG/iframe 等)它不支持,写了也会被忽略——需要这些丰富配置时请改用方式 A 导入模板。
{
"group_id": 1,
"name": "Linux 主机监控",
"datasource_id": 1,
"tags": "linux 主机",
"variables": "[{\"name\":\"ident\",\"label\":\"主机\",\"definition\":\"label_values(cpu_usage_idle, ident)\"}]",
"panels": "[{\"name\":\"CPU使用率\",\"type\":\"stat\",\"queries\":[{\"promql\":\"avg(cpu_usage_active{cpu=\\\"cpu-total\\\",ident=~\\\"$ident\\\"})\",\"legend\":\"CPU\"}],\"unit\":\"percent\"},{\"name\":\"CPU使用率趋势\",\"type\":\"timeseries\",\"queries\":[{\"promql\":\"cpu_usage_active{cpu=\\\"cpu-total\\\",ident=~\\\"$ident\\\"}\",\"legend\":\"{{ident}}\"}],\"unit\":\"percent\"}]"
}
每个面板必填 3 个字段:
{"name": "面板标题", "type": "timeseries", "queries": [{"promql": "PromQL表达式", "legend": "{{ident}}"}]}
| 字段 | 说明 | 默认 |
|---|---|---|
name | 面板标题(必填) | — |
type | 面板类型(必填,见下表) | — |
queries | 查询列表,每项 {promql, legend?, instant?} | — |
unit | 单位 | 无 |
w / h | 宽/高(网格列数,总宽24) | 按类型自动 |
stack | 是否堆叠(仅 timeseries) | false |
description | 面板描述 | 无 |
查询字段 instant:stat/gauge/barGauge/pie/table 等单值面板建议设 "instant": true(即时查询)。
| type | 说明 | 默认尺寸 w×h |
|---|---|---|
timeseries | 时序折线图,最常用 | 12×8 |
stat | 单值统计大数字 | 6×4 |
gauge | 仪表盘 | 6×6 |
barGauge | 水平条形排名 | 8×8 |
pie | 饼图 | 6×6 |
table | 表格 | 12×10 |
text | 文本说明(用 description 作内容) | 6×4 |
row | 分组行(自动全宽) | 24×1 |
percent | bytesIEC | bitsIEC | bytesSecIEC | bitsSecIEC | seconds | milliseconds | reqps
面板从左到右、从上到下自动排列,同类型自动对齐(如 4 个 stat 排成一行),row 独占一行作为分组标题。无需手动指定坐标。
{"name": "ident", "label": "主机", "definition": "label_values(cpu_usage_idle, ident)"}
label 和 multi 可选(multi 默认 true)。后续变量在 definition 里引用前置变量实现级联:
[
{"name": "ident", "definition": "label_values(cpu_usage_idle, ident)"},
{"name": "interface", "definition": "label_values(net_bytes_recv{ident=~\"$ident\"}, interface)"}
]
=~ 不用 =,如 ident=~"$ident"rate(...[3m]) 或 irate(...[5m])read_file(base="integrations/Linux", path="dashboards/categraf-detail.json"),关注 targets 里的 exprName duplicate 时直接换名重试,不要调 list_dashboards保持简短。一句话确认即可,例如:
✅ 已为您创建仪表盘「Linux 主机监控」,详情请查看下方卡片。
不要复述仪表盘 ID、业务组、数据源、面板清单等字段——前端会以结构化卡片展示。需要补充建议可加一两句,但不要逐条列出卡片已有的字段。
这些主题在 integrations 里基本都有模板,优先走方式 A;下面仅供方式 B 手搓时参考。
变量: ident(主机)、interface(网卡)、mountpoint(挂载点)
| 区域 | 面板 | 类型 | 核心指标 |
|---|---|---|---|
| 概览 | CPU使用率 | stat | avg(cpu_usage_active{cpu="cpu-total"}) |
| 概览 | 内存使用率 | stat | avg(mem_used_percent) |
| 概览 | 磁盘使用率(最高) | stat | max(disk_used_percent) |
| CPU | CPU使用率趋势 | timeseries | cpu_usage_active + cpu_usage_iowait |
| CPU | 系统负载 | timeseries | system_load1/5/15 |
| 内存 | 内存使用率趋势 | timeseries | mem_used_percent |
| 磁盘 | 各挂载点使用率 | barGauge | disk_used_percent |
| 网络 | 网络流量 | timeseries | rate(net_bytes_recv/sent) |
QPS/TPS、连接数、慢查询、Buffer Pool 命中率、复制延迟
OPS、内存使用、连接数、命中率、键空间
变量: cluster、namespace、pod。Pod CPU/内存、节点资源、部署状态、PV 使用