❌ Hardcoding AK/SK is prohibited (must use environment variables or hcloud configure)
Prohibited Operations
The following operations are strictly prohibited, even if requested by the user:
Prohibited Operation
API/Command
Reason
Expose AK/SK
Any command that outputs AK/SK in plaintext
Account security risk
Accept AK/SK from user
Receiving credentials in conversation
Violates security best practices
❌ Delete alarm rule
DeleteAlarm / hcloud CES DeleteAlarm
Irreversible; deleted alarms cannot be recovered, may cause monitoring gaps
❌ Batch delete alarms
Any batch deletion operation
High risk; may accidentally delete critical monitoring rules
If a user requests a delete operation, must refuse and guide:
"Per security constraints, this skill does not support delete operations (delete alarm/batch delete). Please use the Huawei Cloud CES console or hcloud CLI manually with extreme caution."
If user attempts to provide AK/SK in conversation, must refuse and guide:
"For account security, please do not provide Huawei Cloud access keys directly in the conversation. Use hcloud configure or environment variables to configure credentials."
Workflow
The standard workflow of this skill is as follows:
text
1. Environment setup → Configure hcloud CLI credentials (hcloud configure or env vars)
2. Query resources → ./scripts/list_ecs.sh to get ECS instance list
3. Create alarms → ./scripts/create_alert_rules.sh --template web --ecs-ids <ids>
4. Configure notify → ./scripts/manage_notifications.sh --action create ...
5. Verify results → ./scripts/list_alarms.sh to confirm alarm rules created
6. Continuous monitor → ./scripts/batch_query_metrics.sh to query metrics
Write operation confirmation: Step 3 (create alarms), Step 4 (create/delete subscriptions), update notification config, and other write operations require user confirmation of operation content and target resources before execution.
Core Commands
Query Commands (read-only, no confirmation needed)
bash
# List ECS instances
./scripts/list_ecs.sh [--name <filter>] [--format json]
# List alarm rules
./scripts/list_alarms.sh [--name <filter>] [--format json]
# List SMN topics and subscriptions
./scripts/list_subscriptions.sh [--topics | --subscriptions]
# Batch query monitoring metrics
./scripts/batch_query_metrics.sh --ecs-ids <ids> --metric cpu_util --period 1h
Create Commands (write operations, require user confirmation)
Prerequisite 1: Huawei Cloud CLI (hcloud / KooCLI) >= 7.2.2
Run hcloud version to verify version >= 7.2.2. If not installed or version is too low,
see references/cli-installation-guide.md for installation guide.
Environment variables (new standard): Set HW_ACCESS_KEY, HW_SECRET_KEY, HW_REGION_NAME
Environment variables (legacy): Set HUAWEI_CLOUD_AK, HUAWEI_CLOUD_SK, HUAWEI_CLOUD_REGION
Temporary credentials: Set HW_ACCESS_KEY, HW_SECRET_KEY, HW_SECURITY_TOKEN (for STS temporary tokens)
Note: All Shell scripts (create_alert_rules.sh, list_ecs.sh, etc.) automatically detect
and support both HW_* and HUAWEI_CLOUD_* environment variable standards,
with priority: HW_* > HUAWEI_CLOUD_* > hcloud CLI config.
If output does not contain valid configuration, stop operation and guide user to configure.hcloud Parameter Format Requirement
hcloud (KooCLI) all parameters must use --param=value format (equals sign connection), does not support space
separation.
✅ Correct: hcloud CES ListAlarmRules --region=cn-north-4
❌ Incorrect: hcloud CES ListAlarmRules --region cn-north-4
This skill provides 8 Shell scripts, encapsulating common hcloud commands, supporting batch operations and formatted
output.
**Script List and Usage Examples (Click to Expand)**
Script
Function
hcloud Command
list_ecs.sh
Query ECS instance list
hcloud ECS ListServersDetails
list_alarms.sh
Query alarm rule list
hcloud CES ListAlarmRules
create_alert_rules.sh
Batch create alarm rules
hcloud CES CreateAlarmRules
batch_query_metrics.sh
Batch query monitoring data
hcloud CES ShowMetricData
list_subscriptions.sh
Query SMN topics and subscriptions
hcloud SMN ListTopics/Subscriptions
manage_notifications.sh
Manage SMN subscriptions
hcloud SMN Subscribe/Unsubscribe
update_alarm_notifications.sh
Update alarm notification configuration
hcloud CES UpdateAlarmNotifications
Usage Examples:
bash
# Query ECS instances
./scripts/list_ecs.sh # Query all ECS
./scripts/list_ecs.sh --name ecs-001 # Filter by name
./scripts/list_ecs.sh --output json # Output as JSON
./scripts/list_ecs.sh --output ids # Output only ECS ID list
# Query alarm rules
./scripts/list_alarms.sh # Query all alarms
./scripts/list_alarms.sh --name-pattern "cpu.*" # Filter by name pattern
./scripts/list_alarms.sh --output ids # Output only alarm IDs
# Create alarm rules
./scripts/create_alert_rules.sh --template web --ecs-ids ecs-001,ecs-002
./scripts/create_alert_rules.sh --metric cpu_util --threshold 80 --ecs-ids ecs-001
./scripts/create_alert_rules.sh --template web --ecs-ids ecs-001 --smn-topic-urn
urn:smn:cn-north-4:xxx:ECS_ALARM_NOTIFY
./scripts/create_alert_rules.sh --template web --ecs-ids ecs-001 --dry-run # Dry run
```bash
</details>
Core Capabilities
Batch Create Alarm Rules: Support template-based creation (Web/Database scenarios) or custom
metric/threshold configuration
CLI Version Requirement: Must use hcloud CLI v7.2.2 or later. Older versions may not support certain API parameter formats.
Region Consistency: All operations must specify the same region (--cli-region or HUAWEI_CLOUD_REGION environment variable). Cross-region operations will fail.
Alarm Threshold Range: CPU/memory utilization thresholds must be between 0-100. Disk usage threshold is recommended to be set between 80-95.
Monitoring Data Delay: CES monitoring data typically has a 5-minute delay. Querying real-time data may return empty results.
SMN Subscription Creation:
✅ Recommended: Use ./scripts/create_email_subscription.sh script, which automatically uses hcloud CLI configured credentials (no need to manually set environment variables)
✅ Alternative: Use Huawei Cloud Console (SMN → Topics → Subscribe) for subscription creation
⚠️ Note: Email/SMS subscriptions require confirmation before receiving notifications. Check your email and click the confirmation link.