记忆

huawei-cloud-mrs-host-alarm-diagnose

试用

Huawei Cloud MRS cluster alarm diagnosis skill. Analyzes the root cause of an MRS alarm based on user-provided alarm information (alarm ID, alarm name, alarm details, occurrence time, node IP, related service and logs), then outputs the root cause, repair steps, and verification method. Diagnosis is driven by the built-in LakeWatch API client and the per-alarm knowledge base under alarms/. No commands outside the knowledge base are fabricated. Applicable to MRS alarm diagnosis and root cause localization scenarios where an alarm ID is provided. Trigger words: "告警诊断", "告警定位", "alarm diagnosis", "alarm diagnose", "MRS告警", "告警原因", "告警ID", "alarm ID", "root cause"

它能做什么

Huawei Cloud MRS cluster alarm diagnosis skill. Analyzes the root cause of an MRS alarm based on user-provided alarm information (alarm ID, alarm name, alarm details, occurrence time, node IP, related service and logs), then outputs the root cause, repair steps, and verification method. Diagnosis is driven by the built-in LakeWatch API client and the per-alarm knowledge base under alarms/. No commands outside the knowledge base are fabricated. Applicable to MRS alarm diagnosis and root cause localization scenarios where an alarm ID is provided. Trigger words: "告警诊断", "告警定位", "alarm diagnosis", "alarm diagnose", "MRS告警", "告警原因", "告警ID", "alarm ID", "root cause"

技能文档

Huawei Cloud MRS Alarm Diagnosis Skill

Overview

This skill diagnoses Huawei Cloud MRS (MapReduce Service) cluster alarms. Given alarm information (alarm ID, alarm name, occurrence time, cluster ID, node, related service/role), it locates the root cause and outputs repair steps and a verification method.

Architecture: Caller (Agent) → lakewatch_api_client.py (Python, scripts/) → LakeWatch API → MRS cluster (node resource data, logs, MRS Manager proxy); per-alarm knowledge base (alarms/.md) drives the diagnosis flow.

Note on language: This SKILL.md, the documents under references/, and the per-alarm knowledge base under alarms/ are all written in English per the repository spec. Commands and code blocks are English throughout.

Applicable Scenarios:

  • An MRS cluster raises an alarm and the root cause must be located
  • An on-call engineer needs guided, per-alarm diagnostic steps
  • Alarm triage where an alarm ID is provided

Typical Use Cases:

  • "MRS集群收到12089告警,帮忙诊断一下"
  • "PMS进程异常告警,告警ID 12007,集群ID xxx,帮我定位原因"
  • "Audit log dump failed alarm 12001, diagnose the root cause"
  • "节点间网络互通异常,告警ID 12089,发生时间 2026/06/11 16:00:32 GMT+08:00"

Critical Constraints

Important constraints:

  1. Read-only: This skill only runs information-gathering commands (view logs, query status). It MUST NOT run any start/stop, modify, or delete operations.
  2. User confirmation for repair: The skill only provides executable repair steps; it MUST NOT directly execute any repair operation. All repair actions require user confirmation.
  3. Strict execution: Diagnose strictly according to the per-alarm knowledge base content. Fabricating diagnostic commands outside the knowledge base is prohibited.

Prerequisites

1. Python Requirements

  • Python >= 3.7
  • Dependencies: pyyaml (YAML parsing), cryptography (Windows AES password encryption only)
  • Linux uses CryptoAPI for password encryption (no cryptography dependency)
  • Verify installation: python3 --version (Linux) / python --version (Windows)

This skill does NOT require KooCLI (hcloud). It calls the LakeWatch API through scripts/lakewatch_api_client.py. For the LakeWatch client setup, see CLI Installation Guide.

2. LakeWatch Credential Configuration

  • A valid LakeWatch service account (username + password)
  • The password MUST be encrypted with --encrypt-password and stored in scripts/lakewatch_api_config.yaml (auth.encrypted_password). Never store the plaintext password.
  • Security Rules:
    • Never expose the LakeWatch password in conversation or command output
    • Never ask the user to input the plaintext password in conversation; use the interactive --encrypt-password flow
    • The token is cached locally with owner-only file permissions (Win: %TEMP%\lakewatch_token\, Linux: /tmp/lakewatch_token/)

3. Access Permissions

  • Reachability to the LakeWatch service endpoint (configured in scripts/lakewatch_api_config.yaml server.host/port)
  • The LakeWatch account must have permission to call the MRS Manager proxy and collect node resource/log data on the target cluster
  • See IAM Policies for the access model and required roles

Command Format Standard

This skill uses the LakeWatch API client instead of KooCLI. The unified command format is:

# Linux
python3 /scripts/lakewatch_api_client.py -a  -p 'key1=value1' -p 'key2=value2'

# Windows
python /scripts/lakewatch_api_client.py -a  -p 'key1=value1' -p 'key2=value2'
ElementRuleExample
python3 / pythonLinux uses python3, Windows uses pythonpython3 lakewatch_api_client.py
-a, --apiAPI name to call (defined in lakewatch_api_config.yaml)-a collect_alarm_node_res_data
-p, --paramAPI parameter in key=value form, repeatable-p 'cluster_id=xxx'
QuotingEvery -p value MUST be wrapped in single quotes to prevent shell parsing of `[] {}()`

Windows (PowerShell) quote rule: every " inside a value must be replaced with """ (including " inside [] and {}), otherwise the server returns {"message":"Unknown exception","success":false,"code":"500"}:

# Correct on Windows
-p 'keywords=["""ERROR"""]'
-p 'env={"""PID""":"""123"""}'

# Wrong on Windows (will fail)
-p 'keywords=["ERROR"]'

Linux (bash) quote rule: keep " as-is inside the value, wrap the whole value in single quotes:

# Correct on Linux
-p 'keywords=["ERROR","Exception"]'
-p 'env={"PID":"123"}'

For the full API catalog, parameters, and the token/encryption mechanism, see LakeWatch API Client.

Workflow

Step 1: Determine Alarm Information

Extract the following alarm information from the user input:

FieldParameterRequiredDescriptionExample
Alarm IDalarm_idOptionalAlarm unique ID, e.g. 1208912007
Alarm namealarm_nameRequiredAlarm Chinese namePMS进程异常
Occurrence timealarm_timeRequiredAlarm occurrence time2026/06/11 16:00:32 GMT+08:00
Cluster IDcluster_idOptionalMRS cluster IDfd04c789-39d4-4847-8fc9-4572fec9414f
Host namenode_nameOptionalHost where the alarm occurred (from the alarm location info)8-5-225-6
Service nameserver_nameOptionalService that raised the alarm (from the alarm location info)Manager
Role namerole_nameOptionalRole that raised the alarm (from the alarm location info)pms
Additional infoadditional_infoOptionalAlarm additional information, usually contains key diagnostic clues

Notes:

  • A node value containing . is a node IP; otherwise it is a host name.
  • If the user does not provide the alarm ID or cluster ID, ask the user to provide the relevant information and stop execution.

Step 2: Locate the Per-Alarm Knowledge Base

Based on the alarm ID, read alarms/.md under this skill directory to get the diagnosis flow for that alarm. Also read LakeWatch API Client for the Python script usage.

If no matching alarm document exists, tell the user: 暂不支持此告警的分析。 (This alarm is not supported for analysis.)

Step 3: Execute Alarm Diagnosis

Follow the per-alarm knowledge base from Step 2 to execute the diagnosis.

Diagnosis execution notes:

  • Use only the specific commands provided in the per-alarm knowledge base; do not infer log paths yourself
  • Variable placeholders (e.g. , ) MUST be substituted with actual values, never hardcoded
  • Command execution results MUST be summarized with a summarization tool
  • When running lakewatch_api_client.py, use python on Windows and python3 on Linux
  • All -p parameter values MUST be wrapped in single quotes; on Windows PowerShell, every " inside a value must be replaced with """
  • Important: After diagnosis, reflect on the diagnosis results to confirm whether the alarm diagnosis is complete

Command failure handling: When a command fails, skip the current check item and continue with the other checks.

Step 4: Output the Diagnosis Conclusion

Output following the template below:

## Diagnosis Result

| Item | Content |
|------|---------|
| Diagnosis time | [time] |
| Cluster ID | [cluster_id] |
| Alarm name | [alarm_name] |
| Alarm ID | [alarm_id] |
| Alarm node | [node info] |
| Alarm occurrence time | [occurrence time] |

### Root Cause

**Preliminary judgment**: [root cause type]

**Analysis basis**:

- [basis 1]
- [basis 2]

### Repair Suggestion

| Priority | Operation | Description | Needs user confirmation |
|----------|-----------|-------------|-------------------------|
| 1 | [operation 1] | [description] | Yes |
| 2 | [operation 2] | [description] | Yes |

Core Commands

Query Alarm Skill Content

# Query the alarm diagnosis skill content by alarm sequence ID
python3 lakewatch_api_client.py -a query_alarm_skill \
  -p 'cluster_id=' \
  -p 'alarm_sequence_id='

Collect Alarm Node Resource Data

# Collect node resource data for a given strategy (system-load, memory-usage, disk-space, etc.)
python3 lakewatch_api_client.py -a collect_alarm_node_res_data \
  -p 'cluster_id=' \
  -p 'strategy_name=system-load' \
  -p 'node_name='

Supported strategy_name values include: system-load, memory-usage, disk-space, disk-io, network-io, file-handle, port-check (needs env={"PORT":""}), high-cpu-processes, high-memory-process, zombie-process, dns-check, network-connectivity-test (needs env={"TARGET_IP":""}), process-basic-info (needs env={"process_name":"java"}), process-file-descriptor (needs env={"PID":""}), jstack-thread-dump (needs env={"PID":""}), disk-health-check, disk-smart-info (needs env={"DISK_DEVICE":"/dev/sda"}), disk-raid-status, ha-resource-status, and more. See LakeWatch API Client for the full list.

Collect Alarm Log Data

# Collect alarm-related log data around the alarm time
python3 lakewatch_api_client.py -a collect_alarm_log_data \
  -p 'cluster_id=' \
  -p 'alarm_time=2026/06/11 16:00:32 GMT+08:00' \
  -p 'log_directory=/var/log/hadoop/hdfs' \
  -p 'log_file_name=hadoop-hdfs-datanode.log' \
  -p 'keywords=["ERROR","Exception"]' \
  -p 'log_type=local'

When the log time format is non-standard ISO (e.g. [2026-07-07 20:54:25,171]), pass time_pattern:

python3 lakewatch_api_client.py -a collect_alarm_log_data \
  -p 'cluster_id=' \
  -p 'alarm_time=2026/07/07 20:54:00 GMT+08:00' \
  -p 'log_directory=/var/log/Bigdata/omm/oms/pms' \
  -p 'log_file_name=pms*.log' \
  -p 'keywords=["ERROR","Exception"]' \
  -p 'log_type=local' \
  -p 'time_pattern=^\[([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})||ymdHMS'

Proxy MRS Manager GET API

# Query audit dump config via the LakeWatch manager-access proxy
python3 lakewatch_api_client.py -a access_manager_get \
  -p 'cluster_id=' \
  -p 'target_url=api/v2/audits/config'

# Query audit logs (returns totalCount)
python3 lakewatch_api_client.py -a access_manager_get \
  -p 'cluster_id=' \
  -p 'target_url=api/v2/audits?limit=1'

target_url MUST NOT start with /. The proxy requires Agent >= 1.0.5 and reported OMS node info. Only GET is supported currently.

Parameter Confirmation

ParameterRequired/OptionalDescriptionDefault
alarm_idOptionalAlarm unique ID, used to locate alarms/.mdN/A
alarm_nameRequiredAlarm Chinese nameN/A
alarm_timeRequiredAlarm occurrence time, format yyyy/MM/dd HH:mm:ss GMT+X:XXN/A
cluster_idOptionalMRS cluster IDN/A
node_nameOptionalAlarm node host name or IPN/A
server_nameOptionalService that raised the alarmN/A
role_nameOptionalRole that raised the alarmN/A
additional_infoOptionalAlarm additional informationN/A
strategy_nameRequired by collect_alarm_node_res_dataResource collection strategyN/A
log_directoryRequired by collect_alarm_log_dataLog directory, must be under /var/log/N/A
log_file_nameRequired by collect_alarm_log_dataLog file name, no path separatorsN/A
keywordsRequired by collect_alarm_log_dataLog keyword filter, JSON arrayN/A
log_typeRequired by collect_alarm_log_datalocal or hdfsN/A
time_patternOptionalNon-standard log time regex, format `regex

Output Format

The diagnosis report is output in Markdown, containing:

  • Diagnosis result table: diagnosis time, cluster ID, alarm name, alarm ID, alarm node, alarm occurrence time
  • Root cause: preliminary judgment + analysis basis (each basis cited from actual command output)
  • Repair suggestion table: priority, operation, description, needs-user-confirmation (all repair actions require user confirmation)

See the template in the Workflow → Step 4 section.

Verification Method

See Verification Method for the installation, configuration, and function verification steps.

Best Practices

  1. Locate the knowledge base first: Always confirm the alarm ID and read alarms/.md before running any command; do not infer diagnostic steps yourself.
  2. Substitute placeholders: Replace , , , , etc. with actual user-provided values; never hardcode them.
  3. Quote parameters: Always wrap -p values in single quotes; on Windows PowerShell, escape " as """ to avoid code:500 errors.
  4. Time format: alarm_time must follow yyyy/MM/dd HH:mm:ss GMT+X:XX; for non-standard log time formats, pass time_pattern.
  5. Summarize results: Use a summarization tool to condense command output before analysis; large raw outputs should not be analyzed directly.
  6. Reflect after diagnosis: After completing the checks, reflect on whether the root cause is confirmed; if not, re-check the per-alarm flow for missed steps.
  7. Read-only: All commands are read-only; repair steps are suggestions only and require user confirmation before execution.

References

DocumentDescription
CLI Installation GuidePython dependencies and LakeWatch client setup
IAM PoliciesLakeWatch/MRS Manager access model and required roles
Verification MethodInstallation, configuration, and function verification
Acceptance CriteriaPass/fail criteria for skill testing
LakeWatch API ClientFull API catalog, parameters, token and encryption mechanism
Related CommandsCommon LakeWatch API commands quick reference
alarms/.mdPer-alarm diagnosis knowledge base (mirrors the MRS product alarm catalog)

Notes

  • Security: This skill is read-only. It never exposes the LakeWatch password; the password is encrypted via --encrypt-password and stored in lakewatch_api_config.yaml. Repair steps are suggestions only.
  • No KooCLI: This skill does not use hcloud; it calls the LakeWatch API through lakewatch_api_client.py. Do not mix in hcloud commands.
  • Command failure: When a command fails, skip the current check item and continue with the other checks; do not abort the whole diagnosis.
  • Known limitations: The access_manager_get proxy only supports GET requests (PUT is not yet available on the Agent side); collect_alarm_log_data requires log_directory to be under /var/log/; some strategy_name values require extra env parameters.

相关技能

Huawei Cloud MRS cluster fault diagnosis skill. Diagnoses service faults, instance faults, and host faults through progressive root cause localization: quick log scan first, host troubleshooting when host issues are found, detailed investigation when no conclusion is reached. Driven by the built-in LakeWatch API client and the per-component knowledge base under components/. No commands outside the knowledge base are fabricated. Applicable to MRS fault diagnosis and root cause localization scenarios where a service name or node name is provided. Trigger words: "故障诊断", "故障定位", "fault diagnosis", "fault diagnose", "MRS故障", "服务故障", "实例故障", "主机故障", "集群排查", "集群诊断", "启动失败", "停止异常", "KrbServer故障", "DBService故障", "fault troubleshooting"

Huawei Cloud MRS Hive SQL specification checking skill. Checks SQL statements against defined syntax and specification rules using the automated checker engine. No extra manual analysis beyond defined rules. Trigger:"Hive SQL优化"、"检查Hive SQL"、"Hive SQL检查"、"Hive SQL规范"、"Hive SQL语法"、"Hive SQL review"

作者 huaweiclouddev-dev

Huawei Cloud MRS Spark SQL specification checking skill. Performs comprehensive SQL statement checking for MRS Spark, including syntax validation, specification compliance, and performance risk detection. triggers: "Spark SQL review", "check Spark SQL", "检查Spark SQL", "Spark SQL检查", "Spark SQL规范", "Spark SQL语法".

2 次安装

DWS cluster memory high root cause diagnosis skill, based on KooCLI v3.2.0+ and DWS Autopilot MCP Server. Automatically collects memory metrics, analyzes roo...

DWS cluster CPU high root cause diagnosis skill, based on KooCLI v3.2.0+ and DWS Autopilot MCP Server. Automatically collects CPU metrics, analyzes root caus...

作者 huaweicloud-skills-team1 次安装

DWS cluster memory high root cause diagnosis skill, based on KooCLI v3.2.0+ and DWS Autopilot MCP Server. Automatically collects memory metrics, analyzes root causes (customer-side / system-side), and outputs a standardized diagnosis report. Applicable to DWS cluster memory usage too high, memory alarms, OOM scenarios. Trigger words: "内存高", "内存告警", "内存诊断", "内存使用率过高", "内存不足", "OOM", "内存溢出", "动态内存使用率超阈值", "high memory", "memory alarm", "memory diagnosis"

作者 huaweicloud-skills-team