con un clic
grafana
Grafana 可视化和监控操作。用于:(1) 查询 Grafana 指标数据 (2) 管理仪表盘和数据源 (3) 创建和编辑图表 (4) 告警配置
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Grafana 可视化和监控操作。用于:(1) 查询 Grafana 指标数据 (2) 管理仪表盘和数据源 (3) 创建和编辑图表 (4) 告警配置
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
GitHub 操作。用于:(1) 管理 GitHub 仓库 (2) 操作 Pull Request (3) 触发 Actions (4) 管理文件和代码 (5) 管理 Issue
⚠️ 需要 ZADIG_API_URL + ZADIG_API_KEY | Zadig DevOps 平台 API 客户端
Apache Apisix API 网关操作。用于:(1) 管理 Apisix 路由 (2) 配置上游和服务 (3) 管理插件 (4) 流量管理和灰度发布。环境变量:APISIX_URL, APISIX_ADMIN_KEY
GitLab 操作。用于:(1) 管理 GitLab 项目和仓库 (2) 操作 Merge Request (3) 触发 CI/CD Pipeline (4) 管理文件和代码 (5) 管理用户和权限
Jenkins CI/CD 操作。用于:(1) 触发 Jenkins 任务构建 (2) 查询任务状态和构建历史 (3) 获取构建日志 (4) 操作 Jenkins 节点和配置
Nacos 配置中心操作。用于:(1) 查询 Nacos 配置 (2) 发布/更新配置 (3) 删除配置 (4) 管理命名空间。环境变量:NACOS_URL, NACOS_USERNAME, NACOS_PASSWORD
| name | grafana |
| description | Grafana 可视化和监控操作。用于:(1) 查询 Grafana 指标数据 (2) 管理仪表盘和数据源 (3) 创建和编辑图表 (4) 告警配置 |
# ~/.openclaw/workspace/.env
GRAFANA_URL=http://grafana.example.com:3000
GRAFANA_API_KEY=your-grafana-api-key
source ~/.openclaw/workspace/.env
source ~/.openclaw/workspace/.env
# 获取所有仪表盘
curl -s -H "Authorization: Bearer $GRAFANA_API_KEY" \
"$GRAFANA_URL/api/dashboards/uid/metrics"
# 获取仪表盘 by UID
curl -s -H "Authorization: Bearer $GRAFANA_API_KEY" \
"$GRAFANA_URL/api/dashboards/uid/ DASHBOARD_UID"
# 创建仪表盘
curl -X POST -H "Authorization: Bearer $GRAFANA_API_KEY" \
-H "Content-Type: application/json" \
"$GRAFANA_URL/api/dashboards/db" \
-d '{
"dashboard": {
"title": "My Dashboard",
"panels": []
},
"folderId": 0,
"overwrite": false
}'
source ~/.openclaw/workspace/.env
# 列出数据源
curl -s -H "Authorization: Bearer $GRAFANA_API_KEY" \
"$GRAFANA_URL/api/datasources"
# 查询数据源健康状态
curl -s -H "Authorization: Bearer $GRAFANA_API_KEY" \
"$GRAFANA_URL/api/datasources/ UID/health"
source ~/.openclaw/workspace/.env
# 列出告警规则
curl -s -H "Authorization: Bearer $GRAFANA_API_KEY" \
"$GRAFANA_URL/api/ruler/grafana/api/rules"
# 创建告警规则
curl -X POST -H "Authorization: Bearer $GRAFANA_API_KEY" \
-H "Content-Type: application/json" \
"$GRAFANA_URL/api/ruler/grafana/api/rules/NAMESPACE" \
-d '{
"name": "Alert Rule",
"interval": "1m",
"conditions": [...]
}'
source ~/.openclaw/workspace/.env
# 通过 Prometheus 数据源查询
curl -X POST -H "Authorization: Bearer $GRAFANA_API_KEY" \
-H "Content-Type: application/json" \
"$GRAFANA_URL/api/ds/query" \
-d '{
"queries": [{
"refId": "A",
"expr": "up",
"datasourceId": 1
}],
"from": "now-1h",
"to": "now"
}'
查看服务健康状态:
source ~/.openclaw/workspace/.env
# 获取仪表盘 UID
DASHBOARD_UID=$(curl -s -H "Authorization: Bearer $GRAFANA_API_KEY" \
"$GRAFANA_URL/api/search?type=dashboards&query=service-health" | \
jq -r '.[0].uid')
# 获取仪表盘数据
curl -s -H "Authorization: Bearer $GRAFANA_API_KEY" \
"$GRAFANA_URL/api/dashboards/uid/$DASHBOARD_UID" | \
jq '.dashboard.panels[] | {title, type, id}'
通过 Prometheus 查询当前 QPS:
source ~/.openclaw/workspace/.env
curl -X POST -H "Authorization: Bearer $GRAFANA_API_KEY" \
-H "Content-Type: application/json" \
"$GRAFANA_URL/api/ds/query" \
-d '{
"queries": [{
"refId": "A",
"expr": "rate(http_requests_total[5m])",
"datasourceId": 1,
"queryType": ""
}],
"from": "now-5m",
"to": "now"
}' | jq '.results.A.frames[0].data.values'
当错误率超过阈值时发送告警:
source ~/.openclaw/workspace/.env
curl -X POST -H "Authorization: Bearer $GRAFANA_API_KEY" \
-H "Content-Type: application/json" \
"$GRAFANA_URL/api/ruler/grafana/api/rules/production" \
-d '{
"name": "Service Alerts",
"interval": "1m",
"rules": [
{
"expr": "rate(http_requests_total{status=~\"5..\"}[5m]) > 0.05",
"alert": "High Error Rate",
"for": "2m",
"labels": {"severity": "critical"},
"annotations": {
"summary": "错误率超过 5%",
"description": "当前错误率: {{ $value }}"
}
}
]
}'
| 端点 | 说明 |
|---|---|
/api/dashboards | 仪表盘管理 |
/api/datasources | 数据源管理 |
/api/search | 搜索资源 |
/api/alerts | 告警列表 |
/api/ruler/ | 告警规则 |