Install
openclaw skills install @huaweicloudskill/huawei-cloud-alarm-bind-inspectionHuawei Cloud alarm baseline configuration read and inspection analysis skill. Fetches all alarm rules for the current account via CES SDK and hcloud AOM CLI, extracts CES and AOM baseline metrics/events from the alarm baseline Excel, compares and analyzes alarm binding status, and generates instance-level binding rate reports and remediation suggestions (Excel + HTML). Use this skill when the user needs to inspect alarm binding coverage, read alarm baselines, analyze alarm rules, or generate alarm binding reports. Triggers include: "告警基线", "告警配置", "告警阈值", "告警巡检", "告警绑定巡检", "alarm bind inspection", "读取告警基线", "生成告警JSON", "分析告警规则", "告警收敛", "CES告警", "AOM告警"
openclaw skills install @huaweicloudskill/huawei-cloud-alarm-bind-inspectionAlarm bind inspection: fetches all alarm rules for the current account via CES (Cloud Eye Service) SDK and hcloud AOM CLI, extracts CES and AOM baseline metrics/events from the alarm baseline Excel, and compares and analyzes alarm binding status. Two merged analysis dimensions (CES + AOM data merged into the same tab, distinguished by a "monitoring system" column):
Uses AK/SK authentication (current account only, no multi-customer mode). AK/SK are read from environment variables (HW_ACCESS_KEY, HW_SECRET_KEY). Regions are auto-extracted from core_instances.json (multi-region supported). Project ID is auto-fetched via hcloud CLI per target region — no manual configuration needed.
python --version, confirm Python exists and version > 3.9python -m pip install -r requirements.txt
Prerequisites:
HW_ACCESS_KEY, HW_SECRET_KEY)hcloud CLI available (used to auto-fetch Project ID)requirements.txt (includes huaweicloudsdkces, huaweicloudsdkcore)python scripts/generate_core_instance.py
Extracts the core instance list from the key resource marking Excel (single-customer mode, no per-customer grouping).
Pre-checks (abort if any not met):
assets/关键资源标记表.xlsx must exist关键资源标记region, resource_type, resource_id, 是否核心业务是否核心业务 = 是 with non-empty resource_type and resource_idOutput: <WORKSPACE_DIR>/intermediate/core_instances.json
Output structure:
{"instances": {"ECS": [...], "RDS": [...], ...}}python scripts/generate_alarm_baseline.py
Extracts two types of baseline data from the alarm baseline Excel:
CES指标基线 sheet: filter by 指标级别=底线指标, exclude records containing "环比" in column R (comparison relation), extract 19 columns (including column F "指标维度" and column AG "备注")CES事件基线 sheet: filter by 事件级别=底线事件, extract 8 columns (B/C/D/E/F/G/H/I)Output:
<WORKSPACE_DIR>/intermediate/indicator_baseline.json — CES metric baseline<WORKSPACE_DIR>/intermediate/event_baseline.json — CES event baseline<WORKSPACE_DIR>/intermediate/aom_indicator_baseline.json — AOM metric baseline (CCE 21 records + other services 36 records = 57 records)<WORKSPACE_DIR>/intermediate/aom_event_baseline.json — AOM event baseline (Modelarts 12 records + other services 15 records = 27 records)AOM baselines extracted from 4 additional sheets:
3. AOM指标基线-CCE sheet: filter 指标级别=底线指标, PromQL structure (18 columns)
4. AOM指标基线-其他服务 sheet: filter 指标级别=底线指标 (22 columns, IoTDA/CCI/Modelarts)
5. AOM-Modelarts事件 sheet: filter 指标级别=底线指标 (15 columns, PromQL event structure)
6. AOM事件基线-其他服务 sheet: filter 事件级别=底线事件 (13 columns)
Fetches all alarm rules for the current account in the specified region(s) via CES SDK (AK/SK auth). CES alarm rules include resource dimension info and notification config — no separate notification rule fetch needed.
Project ID auto-fetch: config.py's fetch_project_id(region) calls hcloud IAM KeystoneListProjects --cli-region=<region> and matches the region name to auto-fetch the corresponding Project ID. If HW_PROJECT_ID env var is explicitly set, it takes priority.
ignore_ssl_verification=False). If your environment uses a self-signed certificate (e.g. internal proxy), you may set it to True in config.py, but document the reason and security risk here.python scripts/main_alarm.py
Auto-reads all regions from core_instances.json, calls CES ListAlarmRules per region, and merges results. Each rule is tagged with a region field for bind_analysis.py to filter by instance region.
Output:
<WORKSPACE_DIR>/intermediate/online_alarm_rules.json — all alarm rules (with resource dimensions, policy metrics, notification config)python scripts/main_aom_alarm.py
Fetches AOM metric-type and event-type alarm rules separately via hcloud AOM ListMetricOrEventAlarmRule. Multi-region supported (regions auto-extracted from core_instances.json).
Output:
<WORKSPACE_DIR>/intermediate/aom_alarm_rules.json — AOM metric alarm rules<WORKSPACE_DIR>/intermediate/aom_event_alarm_rules.json — AOM event alarm rulesExtracts event-type rules (type=EVENT_SYS or EVENT_CUSTOM) from Step 4's alarm rules, output for event baseline analysis.
python scripts/main_event.py
Output:
<WORKSPACE_DIR>/intermediate/online_notification_rules.json — event-type alarm rulespython scripts/enrich_metric_dimension.py
Calls each service's ShowInstance API via hcloud CLI to fetch instance attributes (engine, cache_mode, type, etc.) and infer the most specific metric dimension route. Does not depend on alarm rules — determines dimensions even for instances without alarm configuration.
metric_dimension is a single-value string representing the instance's most specific dimension route, e.g. "dcs_instance_id,dcs_cluster_redis_node". bind_analysis.py uses subset matching: a baseline dimension that is a subset of the instance's metric_dimension is a hit (e.g. dcs_instance_id is a subset of dcs_instance_id,dcs_cluster_redis_node — both hit).
Service coverage (46 baseline services):
| Category | Services | Approach | API Calls |
|---|---|---|---|
| B single-dimension | 22 | Read unique dimension from baseline | 0 |
| C multi-dim + ShowInstance | 18 | Call hcloud ShowInstance to infer | 1 per instance |
| D multi-dim + indirect | 2 | GAUSSDB/ROMA indirect query or fallback | 1 per instance |
| A no hcloud | 4 | OBS uses bucket_name; MaaS not available | 0 |
Verified services:
dcs_instance_id,dcs_cluster_redis_node (22 baseline metrics)listeners[] and pools[] — no extra API neededbandwidth object — no extra API neededinclude_internal param — fallback on 0 instancesOutput: updates <WORKSPACE_DIR>/intermediate/core_instances.json
python scripts/bind_analysis.py
Reads core instance list, metric baseline, and online alarm rules, compares baseline metrics with online rules, and calculates binding rates.
Core logic:
(service_short_name, metric_dimension) two-level groupingresources[].dimensions[].namepolicies[].metric_namemetric_dimension set, a baseline dimension that is a subset of metric_dimension is a hit(instance, metric_dimension) granularityOutput: <WORKSPACE_DIR>/intermediate/indicator_bind_report.json
python scripts/event_bind_analysis.py
Reads event-type alarm rules, event baseline, and core instance list, compares baseline events with events in alarm rules, and calculates binding rates.
Core logic:
service (from namespace) and event_ids (from policies[].metric_name) from event-type alarm rulesresources dimension valuesOutput: <WORKSPACE_DIR>/intermediate/event_bind_report.json
python scripts/aom_bind_analysis.py
Compares AOM metric baseline with AOM metric alarm rules, analyzes binding rates grouped by (service_short_name, metric_dimension). If the service has no core instances, marks no_core_instances.
Output: <WORKSPACE_DIR>/intermediate/aom_indicator_bind_report.json
python scripts/aom_event_bind_analysis.py
Compares AOM event baseline with AOM event alarm rules, analyzes binding rates grouped by service_short_name.
Output: <WORKSPACE_DIR>/intermediate/aom_event_bind_report.json
python scripts/generate_excel_report.py
Output: <WORKSPACE_DIR>/indicator_bind_report.xlsx (CES metric sheet + AOM metric sheet)
python scripts/generate_event_excel_report.py
Output: <WORKSPACE_DIR>/event_bind_report.xlsx (CES event sheet + AOM event sheet)
python scripts/generate_suggestion.py
Output: <WORKSPACE_DIR>/suggestion_report.html
HTML report includes:
Step 1 ─→ Step 2 ─→ Step 4 ─→ Step 5 ─┐
│ └→ Step 4b ──────┐
Step 3 ─┼─────────→ Step 6 ─┬→ Step 7a ─→ Step 8a ─┐
Step 2 ─┘ └→ Step 7b ─→ Step 8b ─┤
Step 4 ─→ Step 6 ─┘ ├─→ Step 8c
Step 4b ─→ Step 7c ─→ Step 8a ────────────────┤
Step 4b ─→ Step 7d ─→ Step 8b ────────────────┘
Output files are written to a timestamped working directory managed by workspace.py. The directory uses a two-level structure separating final deliverables from intermediate data:
/root/workspace/alarm-bind-inspection-workspace_YYYYMMDD_HHMMSS<WORKSPACE_DIR>/ — final output files (.xlsx, .html), i.e. user deliverables<WORKSPACE_DIR>/intermediate/ — intermediate files (.json), passed between steps, not directly user-facingALARM_WORKSPACE_DIR environment variableUsage:
# Option 1: explicitly set shared directory (recommended for multi-script runs)
export ALARM_WORKSPACE_DIR="/root/workspace/alarm-bind-inspection-workspace_$(date +%Y%m%d_%H%M%S)"
python scripts/generate_core_instance.py
python scripts/main_alarm.py
# ... all scripts output to the same directory
# Option 2: no env var set (single-script standalone run auto-creates a timestamped directory)
python scripts/generate_core_instance.py
<WORKSPACE_DIR> in the workflow steps above refers to the directory root level; intermediate file paths are <WORKSPACE_DIR>/intermediate/.
assets/关键资源标记表.xlsx关键资源标记resource_type columnresource_id columnregion column (English Region ID)是否核心业务 column (filter rows where value is "是")assets/华为云租户面监控告警基线-V26.01-beta.xlsxCES指标基线指标级别 = 底线指标assets/华为云租户面监控告警基线-V26.01-beta.xlsxCES事件基线事件级别 = 底线事件assets/华为云租户面监控告警基线-V26.01-beta.xlsxAOM指标基线-CCE (18 columns, PromQL structure) — filter 指标级别=底线指标AOM指标基线-其他服务 (22 columns, IoTDA/CCI/Modelarts) — filter 指标级别=底线指标assets/华为云租户面监控告警基线-V26.01-beta.xlsxAOM-Modelarts事件 (15 columns, PromQL event structure) — filter 指标级别=底线指标AOM事件基线-其他服务 (13 columns) — filter 事件级别=底线事件HW_ACCESS_KEY — Huawei Cloud AKHW_SECRET_KEY — Huawei Cloud SKHW_SECURITY_TOKEN — Security token (optional, for temporary AK/SK scenarios)HW_PROJECT_ID — Project ID (optional, auto-fetched if not set)core_instances.json (multi-region); can override to single region with --regionHW_PROJECT_ID is not set, config.py auto-queries the corresponding Project ID via hcloud IAM KeystoneListProjects --cli-region=<region>ignore_ssl_verification=False). If your environment uses a self-signed certificate (e.g. internal proxy), you may set it to True in config.py, but document the reason and security risk here.main_alarm.py — Fetch all alarm rules via CES SDK (AK/SK auth, multi-region)main_event.py — Extract event-type rules from alarm rules (type=EVENT_SYS/EVENT_CUSTOM)generate_alarm_baseline.py — Extract CES metric/event baseline and AOM metric/event baseline JSON from Excelmain_aom_alarm.py — Fetch AOM alarm rules via hcloud AOM (metric + event, multi-region)aom_bind_analysis.py — Compare and analyze AOM metric baseline binding rateaom_event_bind_analysis.py — Compare and analyze AOM event baseline binding rategenerate_core_instance.py — Extract core instance list JSON from Excel (single-customer mode)enrich_metric_dimension.py — Enrich core instances with metric_dimension (infer via hcloud ShowInstance)bind_analysis.py — Compare and analyze metric baseline binding rateevent_bind_analysis.py — Compare and analyze event baseline binding rategenerate_excel_report.py — Generate metric baseline Excel reportgenerate_event_excel_report.py — Generate event baseline Excel reportgenerate_suggestion.py — Generate merged HTML suggestion report (metric + event)alarm_api.py — CES SDK API wrapperconfig.py — CES client config (AK/SK from env vars, Project ID auto-fetch, region list)workspace.py — Working directory management (timestamped output dir, intermediate files in intermediate/ subdir, final outputs at root level, shared via ALARM_WORKSPACE_DIR env var)diagnose_event.py — Event-type alarm rule diagnostic toolassets/华为云租户面监控告警基线-V26.01-beta.xlsx — Baseline data sourceassets/关键资源标记表.xlsx — Core instance data source<WORKSPACE_DIR>/)<WORKSPACE_DIR>/indicator_bind_report.xlsx — Metric baseline Excel report (CES + AOM)<WORKSPACE_DIR>/event_bind_report.xlsx — Event baseline Excel report (CES + AOM)<WORKSPACE_DIR>/suggestion_report.html — Merged HTML suggestion report (CES + AOM)<WORKSPACE_DIR>/intermediate/)core_instances.json — Core instance listindicator_baseline.json — CES baseline metrics JSONevent_baseline.json — CES baseline events JSONecs_special_events.json — ECS special events for AI scenariosaom_indicator_baseline.json — AOM baseline metrics JSONaom_event_baseline.json — AOM baseline events JSONonline_alarm_rules.json — CES alarm rulesonline_notification_rules.json — Event-type alarm rulesaom_alarm_rules.json — AOM metric alarm rulesaom_event_alarm_rules.json — AOM event alarm rulesindicator_bind_report.json — CES metric binding rate analysisevent_bind_report.json — CES event binding rate analysisaom_indicator_bind_report.json — AOM metric binding rate analysisaom_event_bind_report.json — AOM event binding rate analysis| Variable | Description | Required | Example |
|---|---|---|---|
HW_ACCESS_KEY | Huawei Cloud Access Key (AK) | Yes | AKxxx... |
HW_SECRET_KEY | Huawei Cloud Secret Key (SK) | Yes | SKxxx... |
HW_SECURITY_TOKEN | Security token for temporary AK/SK | No | token-string |
HW_PROJECT_ID | Project ID; auto-fetched if not set | No | 0a1b2c3d... |
ALARM_WORKSPACE_DIR | Shared working directory for multi-script runs | No | /root/workspace/alarm-bind-inspection-workspace_20260101_120000 |
| Parameter | Description | Used By | Default |
|---|---|---|---|
--region | Override to single region (skips multi-region auto-extract) | main_alarm.py, main_aom_alarm.py | None (auto-extract from core_instances.json) |
| Parameter | Description | Used By | Example |
|---|---|---|---|
--cli-region | Region ID for hcloud API calls | enrich_metric_dimension.py, main_aom_alarm.py, config.py | --cli-region=cn-north-4 |
Note: --cli-region is the hcloud CLI (KooCLI) parameter for specifying the region. It is used internally by scripts when calling hcloud commands such as:
# AOM alarm rule fetch (inside main_aom_alarm.py)
hcloud AOM ListMetricOrEventAlarmRule --cli-region=cn-north-4
# Instance detail fetch (inside enrich_metric_dimension.py)
hcloud ECS ShowServer --cli-region=cn-north-4
# Project ID auto-fetch (inside config.py)
hcloud IAM KeystoneListProjects --cli-region=cn-north-4
Refer to documents in the references/ directory for more information:
design.md: Skill design document — architecture, data flow, and analysis logiccli-installation-guide.md: hcloud CLI (KooCLI) installation and configuration guideiam-policies.md: Required IAM permissions and AK/SK configurationverification-method.md: Skill verification and testing methodsacceptance-criteria.md: Quality standards and acceptance criteria