@johnny-joster/n9e-plugin
v1.0.10
Published
Nightingale alert platform query plugin for OpenClaw
Downloads
254
Maintainers
Readme
N9e Plugin for OpenClaw
夜莺(Nightingale)告警平台查询插件,支持通过自然语言查询告警事件、历史告警、告警规则和告警屏蔽配置。
功能特性
- ✅ 查询当前活跃告警
- ✅ 查询历史告警记录
- ✅ 查询告警规则配置
- ✅ 查询告警屏蔽规则
- ✅ 自然语言交互
- ✅ 全局查询(跨所有业务组)
- ✅ 完善的错误处理
快速开始
1. 安装插件
# 从本地目录安装(开发模式)
openclaw plugins install -l ./n9e-plugin
# 或从npm安装
openclaw plugins install @youdao/n9e-plugin2. 配置插件
编辑OpenClaw配置文件,添加以下配置:
{
"plugins": {
"entries": {
"n9e-plugin": {
"enabled": true,
"config": {
"apiBaseUrl": "https://n9e-dev.inner.youdao.com/api/n9e",
"apiKey": "your-api-key-here",
"timeout": 30000
}
}
}
}
}3. 重启Gateway
openclaw gateway restart4. 验证安装
openclaw plugins list使用示例
与Agent对话即可使用:
用户: 查一下最近的告警
→ Agent调用 n9e_query_active_alerts
→ 返回: 当前有5条活跃告警...
用户: 昨天有哪些告警
→ Agent调用 n9e_query_historical_alerts
→ 返回: 昨天共有15条告警...
用户: CPU相关的告警规则
→ Agent调用 n9e_query_alert_rules
→ 返回: 找到3条CPU相关规则...
用户: 哪些告警被屏蔽了
→ Agent调用 n9e_query_alert_mutes
→ 返回: 当前有2条屏蔽规则...API Tools
1. n9e_query_active_alerts
查询当前活跃告警。
参数:
severity: 严重级别(1=严重,2=警告,3=提示)rule_name: 规则名称(支持模糊匹配)limit: 返回数量(默认50)query: 搜索关键词
2. n9e_query_historical_alerts
查询历史告警记录。
参数:
severity: 严重级别rule_name: 规则名称stime: 开始时间戳(秒)etime: 结束时间戳(秒)limit: 返回数量(默认50)
3. n9e_query_alert_rules
查询告警规则配置。
参数:
rule_name: 规则名称datasource_ids: 数据源ID列表disabled: 规则状态(0=启用,1=禁用)limit: 返回数量(默认50)
4. n9e_query_alert_mutes
查询告警屏蔽规则。
参数:
query: 搜索关键词limit: 返回数量(默认50)
项目结构
n9e-plugin/
├── openclaw.plugin.json # 插件清单
├── package.json
├── index.ts # 插件入口
├── src/
│ ├── config-schema.ts # Zod配置Schema
│ ├── n9e-client.ts # 夜莺API客户端
│ ├── types.ts # TypeScript类型定义
│ └── tools/ # 工具实现
│ ├── active-alerts.ts
│ ├── historical-alerts.ts
│ ├── alert-rules.ts
│ └── alert-mutes.ts
└── skills/ # Agent技能
├── query-active-alerts/
├── query-historical-alerts/
├── query-alert-rules/
└── query-alert-mutes/开发
安装依赖
npm install链接模式开发
npm run dev
# 等同于: openclaw plugins install -l .类型检查
npx tsc --noEmit配置说明
| 字段 | 类型 | 必需 | 说明 |
|------|------|------|------|
| apiBaseUrl | string | ✅ | 夜莺API地址 |
| apiKey | string | ✅ | API访问密钥 |
| timeout | number | ❌ | 请求超时(毫秒),默认30000 |
错误处理
| 错误类型 | 提示信息 | |---------|---------| | 网络错误 | 无法连接到夜莺平台,请检查网络或配置 | | 401/403 | 认证失败,请检查API Key配置 | | 404 | 未找到指定的资源 | | 500 | 夜莺服务器错误,请稍后重试 | | 超时 | 请求超时,请检查网络连接 |
许可证
MIT
作者
Youdao DevOps Team
