Create Alibaba Cloud CMS alert rules via CLI (write-operation skill). Supports CMS 1.0 cloud resource monitoring for ALL CMS-integrated cloud products. This skill performs write operations: creating alert rules, contacts, and contact groups. Use when: creating monitoring alerts, setting up alarm rules, configuring CMS alert policies for any cloud product, or managing cloud monitoring notifications. Triggers: "create alert", "setup monitoring", "configure alarm", "CMS alert", "cloud monitor rule", "告警规则", "创建告警", "监控报警".
This skill creates CMS 1.0 alert rules for cloud resource monitoring using CloudMonitor metrics. Supports all CMS-integrated cloud products through dynamic metric discovery.
| Step | Description | CMS 1.0 | Reference |
|---|---|---|---|
| 1 | Context Lock | namespace, region, instances | step1-context-lock.md |
| 2 | Query Generation | Call describe-metric-meta-list to discover metrics for namespace, match to user intent | step2-query-generation.md |
| 3 | Detection Config | threshold, frequency (default 1min) | step3-detection-config.md |
| 4 | Notification | Query contacts → select or create | step4-notification.md |
| 5 | Preview & Execute | Show summary → confirm → CLI | step5-preview-execute.md |
| 6 | Verification | Check status | step6-verification.md |
Before creating ANY alert, complete these API calls to ensure correct workflow execution.
| Step | Required API Call | CLI Command | Purpose |
|---|---|---|---|
| 1 | DescribeProjectMeta | aliyun cms describe-project-meta | List cloud product namespaces (when product is unclear) |
| 2 | DescribeMetricMetaList | aliyun cms describe-metric-meta-list --namespace <ns> | Metric Discovery: Get available metrics (fallback: metrics.md) |
| 4 | DescribeContactGroupList | aliyun cms describe-contact-group-list | Query existing contact groups |
| 5 | PutResourceMetricRule | aliyun cms put-resource-metric-rule ... | Create the alert rule |
These API calls are required for every alert creation. Always query contacts via the designated tools, even if the values seem known.
This step is REQUIRED and CANNOT be skipped.
describe-contact-group-list before creating any CMS alertThe
--resourcesparameter MUST always be explicitly passed. Never omit this parameter.
--resources '[{"resource":"_ALL"}]'--resources '[{"resource":"i-xxx"}]' or --resources '[{"resource":"i-xxx"},{"resource":"i-yyy"}]'This applies to ALL products (ECS, RDS, SLB, OSS, MongoDB, etc.).
| Step 1 | Step 2 | Step 4 | Step 5 |
|---|---|---|---|
describe-project-meta (when product unclear) | describe-metric-meta-list (MANDATORY) | describe-contact-group-list (MANDATORY) | put-resource-metric-rule |
When user mentions a contact group, apply these matching rules:
| User Input | Match Strategy | Common Mappings |
|---|---|---|
| "运维组" / "ops" | Contains/keyword | → 运维组, ops-alert-group, SRE-Team |
| "基础设施组" | Contains/keyword | → infrastructure, infrastructure-team |
| "DBA团队" | Contains/keyword | → DBA-Alert-Group, dba-team |
| "网络组" | Contains/keyword | → network-ops, network-sre |
| Exact name | Direct match | Use exact name if found |
All aliyun CLI commands MUST be executed with a timeout to prevent hanging:
Before creating an alert rule, check if a rule with the same configuration already exists:
describe-metric-rule-list --namespace <ns> --metric-name <metric> and check for matching rulesThis skill only accesses Alibaba Cloud OpenAPI endpoints. Allowed domains:
cms.aliyuncs.com — CloudMonitor APIecs.aliyuncs.com — ECS instance queryrds.aliyuncs.com — RDS instance queryslb.aliyuncs.com — SLB instance queryNo other external network access is required or permitted.
MUST call
describe-metric-meta-listAPI to discover metrics for the target namespace. DO NOT hardcode metric names. Usemetrics.mdonly as fallback when API is unavailable.
describe-project-meta to list all available namespaces (when product is unclear)describe-metric-meta-list --namespace <ns> to get available metricsmetrics.md only when API call failsWhen unsure about CLI command syntax, arguments, or available subcommands, use --help to discover:
# List all available CMS commands
aliyun cms --help
# Show detailed usage for a specific command
aliyun cms <command> --help
# Example:
aliyun cms describe-metric-meta-list --help
This is the preferred way to resolve CLI uncertainties rather than guessing parameters.
MUST present configuration summary and get explicit user confirmation BEFORE calling
PutResourceMetricRule.
Even if all parameters are clear, DO NOT execute directly. Always show a configuration summary including: Product, Metric, Threshold, Severity, Resources scope, and Contact Group. Wait for user's explicit "Yes" or confirmation before proceeding.
| Level | Parameter Prefix | Example |
|---|---|---|
| Critical | --escalations-critical-* | --escalations-critical-threshold 85 |
| Warn | --escalations-warn-* | --escalations-warn-threshold 99.9 |
| Info | --escalations-info-* | --escalations-info-threshold 50 |
| File | Purpose |
|---|---|
related_apis.yaml | API lookup before CLI calls |
references/step1-context-lock.md | Context lock |
references/step2-query-generation.md | Query generation |
references/step3-detection-config.md | Detection config |
references/step4-notification.md | Notification |
references/step5-preview-execute.md | Preview & execute |
references/step6-verification.md | Verification |
references/metrics.md | Common metrics quick reference (fallback) |
# Verify aliyun CLI is configured
aliyun configure get
# Set User-Agent for all CLI calls (REQUIRED)
export ALIBABA_CLOUD_USER_AGENT="AlibabaCloud-Agent-Skills"
Important: All aliyun CLI calls in this skill MUST include the User-Agent header. Set the environment variable before executing any commands.