Operations 18 min read

From API to AI Agent: Alibaba Cloud Monitoring CLI + Agent Skill in Action

The article explains how Alibaba Cloud Monitoring CLI (aliyun cms2) and its Agent Skill turn traditional API‑based operations into AI‑driven, natural‑language workflows, enabling secure, auditable, and automated observability tasks such as resource onboarding, alarm management, and data queries.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
From API to AI Agent: Alibaba Cloud Monitoring CLI + Agent Skill in Action
Use the official Alibaba Cloud Monitoring CLI ( aliyun cms2 ) together with the CMS Agent Skill to let an AI Agent safely execute observable operations.

Traditional automation starts from APIs (reading docs, stitching parameters, writing scripts, calling endpoints). The CLI + Skill packages these capabilities into AI‑Agent‑understandable, executable, and verifiable workflows.

Why CLI + Agent Skill?

Production observability loops need more than script generation: a stable CLI entry, standardized domain workflows, optional human confirmation, and verifiable results. The CLI + Skill suite provides these requirements.

Solution Overview

Unified Command Tree – Covers all CMS 2.0 console capabilities (resource onboarding, Prometheus service, application monitoring, user‑experience monitoring, alarm center, event center, etc.) with future extensions for cloud probes and Grafana dashboards.

AI Agent Native Adaptation – Provides --help, --show-schema, --show-example-body for precise guidance; outputs compact CSV via -o text to reduce token consumption; returns structured JSON error codes for automatic decision‑making.

Skill‑Driven Workflows – Skill documentation defines complete business workflows, allowing the Agent to execute complex multi‑step operations without hard‑coding.

Installation & Configuration

Open the Alibaba Cloud Agent Skills portal and install the alibabacloud-cms-manage Skill.

After installation the Agent automatically detects and installs/updates the required aliyun cms2 plugin.

# Verify CLI installation
aliyun version
# Verify cms2 plugin
aliyun cms2 --help

Configure credentials (AccessKey, STS Token, region) either interactively: aliyun configure or non‑interactively:

aliyun configure set \
  --access-key-id YOUR_AK \
  --access-key-secret YOUR_SK \
  --region cn-hangzhou

Practical Scenario 1 – ACK Cluster Onboarding

Steps performed automatically by the Agent:

Query container clusters in the target region via the Cloud Resource Center.

Filter out clusters already integrated with Cloud Monitoring (EntityStore query).

Verify cluster ID, account ownership, and region.

Select the appropriate monitoring Addon, retrieve its schema and workflow template.

Create an integration policy and bind it to the target workspace.

Create an Addon Release to attach the cluster’s metrics to a Prometheus instance.

Verify storage instances, dashboards, and scrape jobs to ensure data flow.

Natural‑language request:

Help me see which container clusters in Hangzhou lack observability and onboard them.

Practical Scenario 2 – Alarm Center

List existing alarm rules for the target container instances.

Retrieve available metrics and labels for the containers.

Generate alarm rule configurations using best‑practice templates.

Dry‑run the generated rules for validation.

Create missing rules.

Modify unreasonable or noisy rules.

Example dialogue:

What are the recommendations for container alerts? Apply them.

Practical Scenario 3 – Prometheus Service

Manage Prometheus instances (create, query, update, delete, list) with optional tag or region filters.

Manage aggregation views (create, query, update, delete, list).

Manage RecordingRules (create, delete, start, stop, list).

Typical command:

aliyun cms2 prometheus instance create --name my-prometheus --region cn-hangzhou

Practical Scenario 4 – Application Performance Monitoring (APM)

The traditional APM onboarding flow involves many steps (infrastructure init, credential acquisition, app registration, template fetching, verification). Using CLI + Skill the process is reduced to a single natural‑language request, e.g.:

Help me onboard the new service "order-service" to APM.

Practical Scenario 5 – Data Query

CPU‑heavy ECS list: "Find the top 10 ECS instances with highest CPU usage in the last 30 minutes." RDS slow queries: "Show the trend of slow queries (>1 s) in the past 30 minutes." Container memory leak suspicion: "List Pods in cluster X, namespace Y, where memory usage has risen continuously over the past hour and exceeds 90 % of the limit."

Capability Overview

Unified command tree – All CRUD operations, list, enable/disable, dry‑run, and verification steps across integration, workspace, Prometheus, APM, RUM, alert, notification, event, metric, trace, entity, and meta domains.

AI Agent native adaptation – --help, schema, example bodies; CSV output; structured JSON errors.

Skill‑driven workflows – Complete business processes encoded in Skill documentation, enabling the Agent to execute multi‑step tasks without hard‑coding.

Conclusion

The Alibaba Cloud Monitoring CLI ( aliyun cms2) together with the CMS Agent Skill transforms console/API capabilities into a standardized, AI‑Agent‑friendly interface. Operators can describe goals in natural language; the AI Agent handles scenario understanding, CLI invocation, API execution, and result verification. This reduces repetitive work, preserves auditability, and frees SREs to focus on higher‑value activities such as alert governance and post‑mortem analysis.

Appendix: CMS CLI Command Tree

aliyun cms2
  ├── integration          # Access management (policy, addon, job-target, etc.)
  │   ├── policy          # create | get | update | delete | list
  │   ├── storage         # list bound Prometheus storage
  │   ├── dashboard       # list associated Grafana dashboards
  │   ├── resource        # list resources for container services
  │   ├── job-target      # list scrape target status
  │   ├── service-monitor # list ServiceMonitor rules
  │   ├── pod-monitor     # list PodMonitor rules
  │   ├── custom-job      # list custom Prometheus jobs
  │   ├── addon-release   # create | get | update | delete | list
  │   └── addon           # get | list
  ├── workspace           # create | get | list | update | delete
  ├── prometheus          # Prometheus service management
  │   ├── instance        # create | get | update | delete | list
  │   ├── view            # create | get | update | delete | list
  │   └── recording-rule  # create | get | update | start | stop | delete | list
  ├── apm                 # Application Performance Monitoring
  │   ├── service         # create | get | update | delete | list
  │   └── configuration   # get | create
  ├── rum                 # User Experience Monitoring
  │   ├── service         # create | get | update | delete | list
  │   └── configuration   # get | create
  ├── alert               # Alarm center
  │   ├── rule            # create | get | update | patch | delete | list | enable | disable
  │   ├── template        # list | get | create | update | delete | apply
  │   └── history         # list
  ├── notification-channel # Notification channels
  │   ├── contact         # list
  │   ├── robot           # list
  │   └── webhook         # list
  ├── event-hub           # Event center
  │   └── list | get
  ├── metric              # Metric queries
  │   ├── promql          # query | query-range | labels | label-values | series
  │   └── basic           # points | latest | range | top | export
  ├── trace               # Trace queries
  │   └── search | tree
  ├── entity              # Cloud resource and EntityStore queries
  │   └── query
  └── meta                # Metadata queries
      └── metrics | namespaces | events
CLI + Skill diagram
CLI + Skill diagram
Scenario illustration
Scenario illustration

Related links:

CMS Agent Skill / Alibaba Cloud Agent Skills portal – https://skills.aliyun.com/skills/alibabacloud-cms-manage

Configure Alibaba Cloud CLI credentials – https://help.aliyun.com/zh/cli/configure-credentials

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

CLIAutomationObservabilityAI AgentAlibaba CloudCloud Monitoring
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.