huawei-cloud-ces-alarm-rules-list
1. 华为云 CES(云监控)告警规则只读盘点:主路径 `hcloud CES ListAlarmRules --cli-region=<region>`(GET /v2/{project_id}/alarms),hcloud 缺失时 回退官方 SDK `huaweicloudsdkces` v2。 2…
by wlc-dev225 installs in other catalogs
Install huawei-cloud-ces-alarm-rules-list in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
华为云 CES 告警规则盘点(只读)
Overview
盘点指定区域的 CES(Cloud Eye,云监控)告警规则,并支持查看单条规则的详情 (阈值策略 + 关联资源 + 通知对象),支撑告警治理盘点。
架构:
agent → python3 scripts/ces_alarm_rules.py [--table|--json|--rule-id]
→ 写意图守卫(只读强制)
→ skill-quality-cli ─▶ hcloud CES ListAlarmRules (CLI,主路径)
cli: ListAlarmRulePolicies (单条详情:阈值策略)
cli: ListAlarmRuleResources (单条详情:关联资源)
cli: ListAlarms (v1,状态补齐)
→ huaweicloudsdkces v2/v1 (hcloud 缺失时回退)
→ 归一化 + 客户端过滤 → 名称列表 / 表格 / 原始 JSON
关键性质:
- 严格只读 — 只构造四个 GET 操作;写意图守卫在参数解析后、任何命令执行前拦截 create / update / delete / enable / disable / batch- / add / remove 等意图,退出码 1。
- CLI 优先、SDK 回退 — KooCLI 可用时走 CLI(经
skill-quality-cli包裹); KooCLI 缺失时回退官方 SDK。凭据始终由 CLI profile / SDK 环境变量提供,脚本不处理密钥。 - 口径以实测为准 — 规则列表路径是
GET /v2/{project_id}/alarms(不是/alarm-rules);ListAlarmRules没有alarm_level/alarm_state/resource_type参数;告警状态只在 v1ListAlarms响应里。核对过程见 references/api-verification.md。 - 状态不做近似 —
insufficient_data独立显示为「数据不足」,绝不与「正常」合并。
Dependency:质量遥测经 skill-quality-cli 自动上报(缺失时由
scripts/ensure_cli.sh安装)。
能力边界:本 skill 只做规则定义与状态盘点,不做任何变更,也不查询指标数据点 (
ShowMetricData/ListMetrics)、告警历史、模板、通知掩码、资源分组、一键告警。 变更操作需要单独 skill 并由用户显式确认。
Prerequisites
- KooCLI(
hcloud) — 主执行路径,见 references/cli-installation-guide.md; 缺失时自动回退 SDK(实测 KooCLI 7.3.12)。 - Python 3.8+ 与官方 SDK —
python3 scripts/ensure_env.py自动安装huaweicloudsdkcore与huaweicloudsdkces(实测 3.1.220);渲染本身只用标准库。 - 凭据带外配置 — CLI 读取 hcloud profile;SDK 回退读取白名单环境变量
(
HUAWEICLOUD_SDK_AK/HUAWEI_ACCESS_KEY…)并需要 project id (CES_ALARM_PROJECT_ID/HUAWEICLOUD_SDK_PROJECT_ID)。 绝不在对话中粘贴 AK/SK,脚本不读取、不回显、不存储密钥。 - IAM 最小授权 —
ces:alarms:list(列表)、ces:alarms:getPolicies、ces:alarms:getResources;策略见 references/iam-policies.md。 - 出网 HTTPS 访问
ces.<region>.myhuaweicloud.com;默认区域cn-north-4。 - skill-quality-cli —
bash scripts/ensure_cli.sh(幂等);关闭遥测SKILL_QUALITY_REPORT=0。
Workflow
- (可选)
python3 scripts/ensure_env.py补齐 SDK 依赖。 - 决定形态:列表盘点(默认)/
--table/--json/ 单条详情(--rule-id)。 - 选定过滤:
--name、--alarm-level、--alarm-state、--resource-type。 - 运行脚本,指定
--region(默认cn-north-4)与--limit(1~100)。 - 读结果:名称列表 / 表格 / 原始 JSON;空结果有明确提示。
- 按下方 Error Handling 处理空、403、缺凭据、
[USE_ERROR]四类异常。
Core Commands
⚠️ 强制质量包裹:
scripts/ces_alarm_rules.py在代码里把每次 hcloud 调用构造为skill-quality-cli run --skill-name huawei-cloud-ces-alarm-rules-list -- hcloud ...。 遥测 CLI 不可用(先跑bash scripts/ensure_cli.sh)或SKILL_QUALITY_REPORT=0时 降级为裸hcloud,只读语义与 CLI→SDK 回退不变。
# 默认:规则名称列表
python3 scripts/ces_alarm_rules.py --region cn-north-4
# 全字段表格(10 列,验收口径)
python3 scripts/ces_alarm_rules.py --table
# 原始 JSON 结构
python3 scripts/ces_alarm_rules.py --json
# 过滤:名称模糊 / 级别 / 状态 / 资源类型
python3 scripts/ces_alarm_rules.py --name cpu --alarm-level 1,2 --table
python3 scripts/ces_alarm_rules.py --alarm-state 数据不足 --table
python3 scripts/ces_alarm_rules.py --resource-type SYS.ECS --table
# 单条规则详情(阈值策略 + 关联资源 + 通知对象)
python3 scripts/ces_alarm_rules.py --rule-id alxxxxxxxxxxxxxxxxxxxxxx
python3 scripts/ces_alarm_rules.py --rule-id alxxxxxxxxxxxxxxxxxxxxxx --json
# 只读凭据就绪检查(同样包裹)
skill-quality-cli run --skill-name huawei-cloud-ces-alarm-rules-list -- hcloud configure list
等价的直接 KooCLI 命令(脚本按需自动翻页):
hcloud CES ListAlarmRules --cli-region=cn-north-4 --limit=100 --offset=0
hcloud CES ListAlarmRules --cli-region=cn-north-4 --alarm_id=<alarm_id> --limit=1
hcloud CES ListAlarmRulePolicies --cli-region=cn-north-4 --alarm_id=<alarm_id> --limit=100
hcloud CES ListAlarmRuleResources --cli-region=cn-north-4 --alarm_id=<alarm_id> --limit=100
hcloud CES ListAlarms --cli-region=cn-north-4 --limit=100 --order=asc # 状态补齐(v1)
Parameter Confirmation
| 参数 | 必填 | 说明 | 示例 |
|---|---|---|---|
--region / -r |
否 | 目标区域(默认 cn-north-4) |
cn-south-1 |
--rule-id |
否 | 单条告警规则 ID(al + 22 位),输出该规则详情 | al1111… |
--name |
否 | 规则名称:先作服务端 name 透传,再做客户端模糊匹配(含 alarm_id) |
cpu |
--alarm-level |
否 | 告警级别过滤(1 紧急 / 2 重要 / 3 次要 / 4 提示;可逗号分隔或重复)客户端过滤 | 1,2 |
--alarm-state |
否 | 状态过滤(ok/alarm/insufficient_data/invalid 或中文名)客户端过滤 |
insufficient_data |
--resource-type |
否 | 资源类型/维度名子串(匹配 namespace、product_name、维度名)客户端过滤 | SYS.ECS |
--limit |
否 | 每页条数,范围 1~100(默认 50,自动翻页) | 100 |
--offset |
否 | 起始分页偏移(默认 0) | 100 |
--max-pages |
否 | 自动翻页上限(默认 100,防死循环) | 20 |
--table |
否 | 输出 10 列全字段表格 | --table |
--json |
否 | 输出接口原始 JSON 结构 | --json |
--table 与 --json 互斥使用(同时给出时以 --json 为先,脚本先判断 --json)。
客户端过滤说明(为什么不服务端过滤)
`hcloud CES ListAlarmRules --cli-region= -
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the huawei-cloud-ces-alarm-rules-list skill do?
1. 华为云 CES(云监控)告警规则只读盘点:主路径 `hcloud CES ListAlarmRules --cli-region=<region>`(GET /v2/{project_id}/alarms),hcloud 缺失时 回退官方 SDK `huaweicloudsdkces` v2。 2. 单条规则详情(`--rule-id`):`ListAlarmRules --alarm_id` + `ListAlarmRulePolicies`(阈值策略)+ `ListAlarmRuleResources`(关联资源)+ 通知对象,用于告警治理逐一核查。 3. 三种输出:默认规则名称列表;`--table` 输出 规则ID·名称·资源类型·监控维度·指标·阈值与比较符·告警级别·当前状态·是否启用·通知方式; `--json` 输出接口原始结构。 4. 四类过滤:`--name`(服务端透传 + 客户端模糊)、`--alarm-level`(1 紧急~4 提示)、 `--alarm-state`(ok/alarm/insufficient_data/invalid)、`--resource-type`; 后三者在 KooCLI 7.3.12 的 ListAlarmRules 中没有对应 query 参数,翻全量后客户端过滤。 5. `--limit` 1~100 + `--offset` 自动翻页(`--max-pages` 上限保护),区域默认 cn-north-4; 当前告警状态由 v1 `ListAlarms` 只读补齐(v2 列表响应无 alarm_state), `insufficient_data` 独立标注「数据不足」,不与「正常」混同。 6. 内置写意图守卫:create / update / delete / enable / disable / batch- / add / remove 等意图在任何命令执行前拒绝,退出码 1;本 skill 严格只读。 7. 触发词:「告警规则盘点」「查询CES告警规则」「告警规则列表」「告警阈值策略」 「告警规则详情」「ces alarm rules list」「alarm rule inventory」「告警治理盘点」。 8. 离线单元测试(mock hcloud / SDK)覆盖守卫、翻页、状态补齐、四类过滤、 三种输出形态、单条详情、错误分类与后端回退。
How do I install the huawei-cloud-ces-alarm-rules-list skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the huawei-cloud-ces-alarm-rules-list skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…