
huawei-cloud-ecs-alert
Automate batch creation and management of Huawei Cloud CES alarm rules for ECS instances using hcloud CLI v7.2.2+. Use this skill to: (1) batch create alarms with templates (web/database), (2) update SMN notifications, (3) query ECS metrics and alarm lists.
- Installs
- 230
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-ecs-alert- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads huawei-cloud-ecs-alert automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Huawei Cloud ECS Alert Automation
Overview
This skill provides batch creation and management of Huawei Cloud CES alarm rules for ECS instances, based on Huawei Cloud CLI (hcloud) v7.2.2+.
Core Capabilities:
- Batch create alarm rules (supports Web/Database templates or custom configuration)
- Configure alarm notifications (supports email/SMS/WeChat)
- Query ECS monitoring metrics
- Query and manage alarm rule lists
Use Cases:
- Batch configure monitoring alarms for newly purchased ECS instances
- Differentiated alarm policies across environments (dev/test/prod)
- Batch query ECS monitoring data
- Centralized alarm notification management
Security Constraints:
- ❌ Delete alarm rules is prohibited (prevent accidental deletion causing monitoring gaps)
- ❌ 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 configureor environment variables to configure credentials."
Unsupported Operations
The following operations are NOT supported by this skill (no script wrapper is provided). If a user requests them, clearly state the limitation and provide the alternative. Do not attempt to improvise commands that this skill has not tested.
| Unsupported Operation | Corresponding API | Alternative |
|---|---|---|
| Query alarm history | ShowAlarmHistory | View in CES console; or run hcloud CES ListAlarmHistories/v1 manually |
| Enable/disable an alarm rule | UpdateAlarm | Operate in CES console (not wrapped by this skill) |
| Modify alarm threshold/metric | UpdateAlarm | Delete and recreate the rule; to change only notifications, use ./scripts/update_alarm_notifications.sh |
| Create an SMN topic | CreateTopic | Create in SMN console; or run hcloud SMN CreateTopic manually |
| Create a monitoring dashboard | CreateOneDashboard | Operate in CES console |
| View a single alarm rule detail | ShowAlarm | Use ./scripts/list_alarms.sh --name <pattern> to filter |
If a user requests one of these operations, respond: "This skill does not support <operation>. Use the Huawei Cloud CES/SMN console, or the equivalent hcloud CLI command manually: <alternative>. You may also request an enhancement via the skill's issue tracker."
Workflow
The standard workflow of this skill is as follows:
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)
# 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)
# Batch create alarm rules (WARNING: confirm target ECS and alarm template)
./scripts/create_alert_rules.sh --template web --ecs-ids ecs-001,ecs-002
# Create SMN subscription (WARNING: confirm subscription endpoint and topic)
./scripts/manage_notifications.sh --action create --protocol email --endpoint user@example.com --topic-urn <URN>
./scripts/create_email_subscription.sh --email user@example.com --topic-urn <URN>
Update/Delete Commands (write operations, require user confirmation)
# Update alarm notification config (WARNING: confirm alarm ID and notification topic)
./scripts/update_alarm_notifications.sh --action add --alarm-id <id> --smn-topic-urn <URN>
# Delete SMN subscription (WARNING: confirm subscription URN)
./scripts/manage_notifications.sh --action delete --subscription-urn <URN>
Architecture
Huawei Cloud CES Alert Management
├── CreateAlertRules (Batch create alarm rules, supports templates/custom)
├── ConfigureNotifications (Configure alarm notifications, supports email/SMS/WeChat)
├── QueryMetrics (Batch query monitoring data, supports multiple ECS)
└── ListAlarmRules (List alarm rules and details)
Prerequisites
Prerequisite 1: Huawei Cloud CLI (hcloud / KooCLI) >= 7.2.2 Run
hcloud versionto verify version >= 7.2.2. If not installed or version is too low, see references/cli-installation-guide.md for installation guide.
hcloud version
Prerequisite 2: Huawei Cloud Credentials Configured Check if CLI configuration contains valid credentials (AK/SK, IAM, etc.).
hcloud configure listCredential Configuration Methods (choose one):
hcloud CLI configuration (recommended):
hcloud configureinteractive setup, credentials encrypted and stored in~/.hcloud/config.jsonPer-call AK/SK: pass
--cli-access-key=<AK> --cli-secret-key=<SK>on each command (for automation; note: appears in process list)⚠️ IMPORTANT: hcloud (KooCLI) authenticates ONLY via
~/.hcloud/config.json(fromhcloud configure) or the--cli-access-key/--cli-secret-keyarguments. It does NOT readHW_ACCESS_KEY,HW_SECRET_KEY,HUAWEI_CLOUD_AK,HUAWEI_CLOUD_SK,HUAWEI_CLOUD_REGION, orHUAWEI_CLOUD_SECURITY_TOKENenvironment variables — such variables are silently ignored (hcloud falls back to config.json). Do not instruct users to export these env vars as a way to authenticate hcloud.Credential source for this skill's scripts: The bundled Shell scripts are thin wrappers around hcloud CLI. They read the region from
HW_REGION_NAME/HUAWEI_CLOUD_REGION(or default tocn-north-4) to set--cli-region, but authentication always comes fromhcloud configure. Configure credentials once withhcloud configure, then the scripts work.
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=valueformat (equals sign connection), does not support space separation. ✅ Correct:hcloud CES ListAlarmRules --cli-region=cn-north-4❌ Incorrect:hcloud CES ListAlarmRules --cli-region cn-north-4This skill provides 8 Shell scripts, encapsulating common hcloud commands, supporting batch operations and formatted output.
<details> <summary>**Script List and Usage Examples (Click to Expand)**</summary>
Script Function hcloud Command list_ecs.shQuery ECS instance list hcloud ECS ListServersDetailslist_alarms.shQuery alarm rule list hcloud CES ListAlarmRulescreate_alert_rules.shBatch create alarm rules hcloud CES CreateAlarmRulesbatch_query_metrics.shBatch query monitoring data hcloud CES ShowMetricDatalist_subscriptions.shQuery SMN topics and subscriptions hcloud SMN ListTopics/Subscriptionsmanage_notifications.shManage SMN subscriptions hcloud SMN AddSubscription / BatchDeleteSubscriptionsupdate_alarm_notifications.shUpdate alarm notification configuration hcloud CES UpdateAlarmNotificationsUsage Examples:
</details># Query ECS instances ./scripts/list_ecs.sh # Query all ECS ./scripts/list_ecs.sh --name ecs-001 # Filter by name ./scripts/list_ecs.sh --format json # Output as JSON ./scripts/list_ecs.sh --format ids # Output only ECS ID list # Query alarm rules ./scripts/list_alarms.sh # Query all alarms ./scripts/list_alarms.sh --name "cpu.*" # Filter by name pattern ./scripts/list_alarms.sh --format 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
Core Capabilities
- Batch Create Alarm Rules: Support template-based creation (Web/Database scenarios) or custom metric/threshold configuration
- Batch Query Monitoring Data: Support multi-ECS concurrent query, output CPU/Memory/Disk metrics
- Notification Configuration: Support email/SMS/WeChat notification, SMN subscription management
- Security Compliance: AK/SK via environment variables or CLI config, never hardcode
Usage Scenarios
Scenario 1: Batch Configure Alarms for New ECS
Background: Purchased 10 new ECS instances, need to configure CPU/Memory alarm rules for all.
Steps:
- Query ECS instance IDs
- Batch create alarm rules using web template
- Configure email notification
# Step 0: Configure credentials once (hcloud CLI reads ~/.hcloud/config.json; it does NOT read AK/SK env vars)
hcloud configure
# Optional: set region env var consumed by the scripts' --cli-region default
export HUAWEI_CLOUD_REGION=cn-north-4
./scripts/list_ecs.sh --format ids
# 2. Batch create alarm rules
./scripts/create_alert_rules.sh --template web --ecs-ids ecs-001,ecs-002,ecs-003
# 3. Configure notification
./scripts/manage_notifications.sh --action subscribe --topic-urn <SMN_TOPIC_URN> --protocol email --endpoint user@example.com
Scenario 2: Query Monitoring Data for Multiple ECS
Background: Need to check CPU utilization for 5 ECS instances over the past hour.
./scripts/batch_query_metrics.sh \
--ecs-ids ecs-001,ecs-002,ecs-003,ecs-004,ecs-005 \
--metric cpu_util \
--from 2024-01-01T10:00:00Z \
--to 2024-01-01T11:00:00Z \
--format table
Input Parameters
- AK/SK: Via
hcloud configure(recommended, stored in~/.hcloud/config.json) — hcloud CLI does NOT read AK/SK environment variables - Security Token (optional): For temporary STS credentials, use
hcloud configure --cli-mode=AKSK+--cli-security-tokenor pass--cli-security-token=<token>per command - Region: Via
--cli-regionparameter orHUAWEI_CLOUD_REGION/HW_REGION_NAMEenv var (default: cn-north-4) - ECS IDs: Comma-separated ECS instance IDs
- Alarm IDs: Comma-separated alarm rule IDs
- Template: Alarm template (web/database)
- Metric: Monitoring metric name. Host metrics:
cpu_util,disk_util_inband(namespace SYS.ECS); memory metric:mem_usedPercent(namespace AGT.ECS) - Threshold: Alarm threshold value
- SMN Topic URN: SMN topic URN for notifications
Parameter Confirmation
All write operations (Create / Update / Delete) must explicitly show operation content and obtain user confirmation before execution.
| Operation Type | Script | Content to Confirm |
|---|---|---|
| Create | create_alert_rules.sh | Target ECS ID list, alarm template/metric/threshold |
| Create | manage_notifications.sh --action create | Subscription protocol, endpoint address, SMN topic URN |
| Create | create_email_subscription.sh | Email address, SMN topic URN |
| Update | update_alarm_notifications.sh | Alarm ID, SMN topic URN, operation type |
| Delete | manage_notifications.sh --action delete | Subscription URN (irreversible after deletion) |
Query operations (list_ecs / list_alarms / list_subscriptions / batch_query_metrics) are read-only and do not require confirmation.
Output Format
- Table: Formatted table output (default)
- JSON: JSON format for programmatic processing
- IDs: Only ID list for scripting
Verification Method
After executing any operation, verify using the following methods:
- List Alarms:
./scripts/list_alarms.sh --name <pattern> - Query Metrics:
./scripts/batch_query_metrics.sh --ecs-ids <ids> --metric cpu_util - Check Notifications:
./scripts/list_subscriptions.sh
See references/troubleshooting.md for common verification issues.
Best Practices
- Use Templates for Standard Scenarios: Web/Database templates cover most use cases
- Configure Multiple Notification Channels: Email + SMS for critical alarms
- Set Reasonable Thresholds: CPU 80%, Memory 85%, Disk 90% recommended
- Configure Credentials via
hcloud configure(hcloud CLI reads~/.hcloud/config.json; it does NOT read AK/SK env vars):- ✅ Recommended:
hcloud configure(encrypted storage in~/.hcloud/config.json) - ⚠️ Region env var only:
HUAWEI_CLOUD_REGION/HW_REGION_NAMEset the script's--cli-regiondefault — region only, NOT authentication - ❌ Prohibited: Hardcode AK/SK in scripts or configuration files
- ❌ Misleading:
export HUAWEI_CLOUD_AK/SKorexport HW_ACCESS_KEY/SECRET_KEYwill NOT authenticate hcloud (env vars are ignored)
- ✅ Recommended:
- Use Environment Check Script: Run
./scripts/check_env.shbefore first use to verify configuration
Common Issues
Issue 1: hcloud Command Not Found
Solution: Install KooCLI, see references/cli-installation-guide.md
Issue 2: 403 Forbidden
Solution: Check IAM permissions, ensure CES FullAccess and SMN FullAccess policies are granted. See
references/iam-policies.md
Issue 3: Alarm Creation Fails
Solution: Check metric name and threshold range. CPU/Memory thresholds should be 0-100.
Issue 4: No Monitoring Data
Solution: Check ECS instance status and metric collection interval. Data may have 5-minute delay.
See references/troubleshooting.md for more troubleshooting guides.
Important Notes
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-regionorHUAWEI_CLOUD_REGIONenvironment 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.shscript, 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.
See references/smn-subscription-guide.md for detailed guide.
Batch Operation Limits: Single batch creation is recommended for no more than 20 ECS instances. Too many instances may cause API timeout.
Credential Security:
- ✅ Recommended: Use
hcloud configure— credentials stored encrypted in~/.hcloud/config.json, which is the ONLY credential source hcloud CLI reads- ⚠️ Region env var only (NOT auth):
HUAWEI_CLOUD_REGION/HW_REGION_NAMEset the scripts'--cli-regiondefault- ❌ Misleading:
export HW_ACCESS_KEY/HW_SECRET_KEYorexport HUAWEI_CLOUD_AK/HUAWEI_CLOUD_SKdo NOT authenticate hcloud (env vars are ignored)- ❌ Prohibited: Hardcode AK/SK in scripts or configuration files
Authentication: hcloud CLI authenticates ONLY via
~/.hcloud/config.json(fromhcloud configure) or--cli-access-key/--cli-secret-keyper-command arguments. Environment variables for AK/SK/token are silently ignored. Do not document env-var export as a working authentication method.
Reference Documents
- CLI Installation Guide
- IAM Policies
- Related APIs
- Troubleshooting
- SMN Subscription Guide
- Common Commands
- Memory Monitoring Guide
- Acceptance Criteria
FAQ
What does the huawei-cloud-ecs-alert skill do?
Automate batch creation and management of Huawei Cloud CES alarm rules for ECS instances using hcloud CLI v7.2.2+. Use this skill to: (1) batch create alarms with templates (web/database), (2) update SMN notifications, (3) query ECS metrics and alarm lists.
How do I install huawei-cloud-ecs-alert?
Run npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-ecs-alert in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/huawei-cloud-ecs-alert/ (personal) or .claude/skills/huawei-cloud-ecs-alert/ (project).
Which AI agents can use huawei-cloud-ecs-alert?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is huawei-cloud-ecs-alert safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains huawei-cloud-ecs-alert?
It is published by huaweicloud in huaweicloud/huaweicloud-skills. It has 230 recorded installs.
More from huaweicloud/huaweicloud-skills
huawei-cloud-terraform-installer
huaweicloud/huaweicloud-skills
Installs Terraform CLI cross-platform with Huawei Cloud mirror support. Use this skill whenever the user mentions installing Terraform, setting up Terraform environment, or when IaC tasks detect missing Terraform. Trigger: install terraform, setup terraform, terraform environment, huaweicloud provider.
huawei-cloud-find-skills
huaweicloud/huaweicloud-skills
Invoke this skill to search, list, query, discover, browse, find and install any Huawei Cloud (华为云) agent skill. Triggers include: "华为云", "华为云有什么skill", "华为云相关skill", "华为云agent skill 市场", "华为云skill类目", "explore Huawei Cloud skills", "show Huawei Cloud skill categories", "does a Huawei Cloud skill exist for...", "which Huawei Cloud skills exist", "搜索华为云技能", "查询华为云skill列表", "有没有管理ECS/OBS/RDS的skill", "帮我找 XX 华为云skill", "介绍 XX Skill 内容", "华为云 XX Skill 具体做什么", "安装华为云Skill".
huawei-cloud-billing-scout
huaweicloud/huaweicloud-skills
Huawei Cloud BSS billing (not AWS/Azure/other clouds; refuses pricing quotes, real-name review, and any non-billing scope): balance, spend, attribution, reconciliation, coupons, stored-value cards, enterprise/partner billing. One-page briefing via hcloud. Use only when the user explicitly mentions 华为云 / Huawei Cloud / BSS and 余额/账单/对账/资源包/代金券/储值卡/企业或伙伴账务; refuses pay, renew, refund, delete.
huawei-cloud-computing-query
huaweicloud/huaweicloud-skills
Queries Huawei Cloud computing resources (ECS/BMS/IMS/AS), Covers ECS instances, flavors, keypairs, quotas, server groups, block devices, NICs, VNC console, BMS bare metal servers/flavors/quotas, IMS images/OS versions/members/quotas, and AS scaling groups/configs/policies/activity logs/lifecycle hooks/warm pools/quotas. No write operations. Use this skill when the user needs to query ECS instance details, list flavors, check BMS availability, browse images, or view auto-scaling group/policy status. Triggers: 弹性云服务器, ECS, 裸金属, BMS, 镜像, IMS, 弹性伸缩, AS, 伸缩组, 伸缩策略, 规格查询, flavor, instance, image, scaling.
huawei-cloud-obs-upload
huaweicloud/huaweicloud-skills
Upload local files or directories to Huawei Cloud OBS (Object Storage Service) buckets, list OBS buckets with capacity and object count, and schedule periodic uploads via crontab. Use this skill when the user wants to: (1) upload a local file or directory to an OBS bucket, (2) list OBS buckets and check their storage capacity and object count, (3) set up a scheduled/periodic upload task to automatically sync a local directory to an OBS bucket. Triggers include: user mentions "OBS", "object storage", "bucket list", "bucket capacity", "upload to OBS", "upload file", "upload directory", "scheduled upload", "periodic upload", "sync to bucket", "对象存储", "桶列表", "桶容量", "上传文件", "上传目录", "定时上传", "OBS管理"
huawei-cloud-terraform-generator
huaweicloud/huaweicloud-skills
Generate Huawei Cloud Terraform configurations and execute deployment with user-guided approval. Use this skill when users want to create Huawei Cloud infrastructure as Terraform, whether they ask explicitly for Terraform or describe goals such as deploying a website, launching an application, or creating network, compute, database, load balancing, or storage resources. Trigger when users mention 创建/create、生成/generate、部署/deploy、配置/configure、使用/use、管理/manage、华为云/Huawei Cloud、Terraform、ECS、VPC、资源/resource、云服务器/ECS、虚拟机/VM、实例/instance、网络/network、负载均衡/ELB、数据库/database、RDS、存储/storage、OBS、桶/bucket、域名/domain、DNS、证书/certificate、SSL、监控/monitoring、日志/log、备份/backup、容器/container、CCE、函数工作流/FunctionGraph
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.