Cloud Monitor CLI
The official Cloud Monitor CLI runs as the cms2 plugin of Alibaba Cloud CLI. It uses aliyun cms2 <resource> <action> to query and manage Cloud Monitor 2.0. The CLI is built for command line use in terminals, CI pipelines, and scripts: it produces structured output, fails explicitly, and resolves credentials through the RAM and Alibaba Cloud configuration chain instead of taking credentials as command business parameters.
This topic describes the official CLI only, which is intended for terminals, CI pipelines, and scripts. To connect from an MCP client such as Cursor, Claude Code, or Lingma, use Cloud Monitor MCP instead. Do not use the installation and authentication steps in this topic for MCP.
Cloud Monitor MCP Cloud and the open-source observability MCP Server are not the same service.
Capabilities
The Cloud Monitor CLI covers query and management operations for Cloud Monitor 2.0 in the following areas:
Integration and workspaces: integration policies, add-ons, and collection prechecks (
integration); Cloud Monitor (CMS) workspaces (workspace); and data source integration and entity bundles (datasource)Prometheus: Managed Service for Prometheus instances, aggregate views, and pre-aggregation rules; PromQL pass-through queries (
prometheus)Grafana: Managed Service for Grafana workspaces, including create, retrieve, update, and delete operations; data sources, dashboards, and folders within an instance (
grafana, through ARMS)Application observability: application performance management (APM) and real user monitoring (RUM) applications and configurations, agent configurations, log correlation, diagnostic tasks, and RUM symbol file uploads (
apm,rum)Synthetics monitoring: site monitoring tasks, public and internal detection points, and VPC metadata (
synthetics)Alerts and events: alert rules and templates, alert history (
alert); notification channels (notification-channel); and Event Center event queries and Logstore addressing (event-hub)Metrics and entities: metric queries for Cloud Monitor basic metrics (
metric), metric metadata (meta), entity queries (entity), UModel queries (umodel), and trace search and call trees through Tracing Analysis (trace)Reports and activation: resource usage reports (
resource-watermark), tags (tag), resource groups (resource-group), and Alibaba Cloud service activation status (aliyun-service)
Download and install
After you install the cms2 plugin of Alibaba Cloud CLI, call the Cloud Monitor CLI through aliyun cms2.
Before you run commands, complete the following preparations: install Alibaba Cloud CLI and verify the cms2 plugin (this section), configure credentials (Authentication), grant the required permissions (RAM permissions), and make sure that the related Alibaba Cloud services are activated. To check the activation status of services such as Prometheus, Grafana, and Resource Center, run aliyun cms2 aliyun-service status.
Install or update Alibaba Cloud CLI
First, install or update Alibaba Cloud CLI to the latest version, and make sure that aliyun is in your PATH:
aliyun versionIf Alibaba Cloud CLI is installed and available in your PATH, this command displays the installed CLI version.
Verify the installation
Run the following commands to verify that the cms2 plugin is installed:
aliyun cms2 --help
aliyun cms2 --versionIf aliyun cms2 --help lists the available commands and aliyun cms2 --version displays version information, the plugin is installed. All subsequent commands use aliyun cms2. For example:
aliyun cms2 workspace list
aliyun cms2 alert rule list --workspace <workspace>Authentication
The Cloud Monitor CLI does not take an AccessKey as a command business parameter. Whether a call succeeds depends on the RAM permissions of the current identity.
aliyun cms2 reuses the credentials of Alibaba Cloud CLI. (Recommended) Manage the credentials with aliyun configure.
# Interactive configuration (recommended)
aliyun configure
# Non-interactive configuration
aliyun configure set \
--access-key-id <AccessKeyId> \
--access-key-secret <AccessKeySecret> \
--region cn-hangzhouFor more information, see Configure credentials.
Credentials are resolved in the following order of precedence, from highest to lowest:
Command-line parameters:
--access-key-id,--access-key-secret, and--security-tokenEnvironment variables:
ALIBABA_CLOUD_CMS_ACCESS_KEY_ID,ALIBABA_CLOUD_CMS_ACCESS_KEY_SECRET,ALIBABA_CLOUD_CMS_SECURITY_TOKEN, andALIBABA_CLOUD_CMS_REGIONAlibaba Cloud CLI configuration:
~/.aliyun/config.json(written byaliyun configure)
Take note of the following items:
Do not use the AccessKey of your Alibaba Cloud account. Use a RAM user and grant permissions based on the principle of least privilege.
Each precedence level can partially override the others. For example, you can provide only the AccessKey ID as a flag and let the configuration file supply the AccessKey secret. Make sure that the final credentials belong to the same account.
If you use multiple profiles, switch between them with
aliyun configure switch --profile <name>. You can runaliyun sts GetCallerIdentityto check the currentAccountId.aliyun sts GetCallerIdentityis a general Alibaba Cloud CLI command and is not part of thecms2plugin.Workspace names usually follow the pattern
default-cms-<uid>-<region>. When you operate on a workspace, the credentials must belong to the same account.
RAM permissions
For read-only investigations, grant AliyunCloudMonitorReadOnlyAccess. Grafana workspace commands also require ARMS permissions, and trace and event query operations also require the Simple Log Service (SLS) permission log:GetLogStoreLogs. For write operations, grant AliyunCloudMonitorFullAccess, or grant only the precise actions listed in the Required API permissions column of each command table in Command reference.
The actions in the command tables map to the following API versions. Most management operations use CMS 2024-03-30. Basic monitoring metrics and resource usage reports use CMS 2019-01-01. Grafana workspaces use ARMS 2019-08-08. APM agent configurations use SLS 2020-12-30.
For information about system policies, see Cloud Monitor 2.0 RAM access policy reference.
Command reference
The CLI currently provides 196 leaf commands, grouped by the first segment of the command tree. The number of commands may change with version updates; the output of aliyun cms2 --help is the authoritative list. The tables in this section describe what each command does and the API permissions it requires. For the parameters, flags, and output format of a specific command, run that command with --help.
Command group | Capability area | Number of commands |
| Provisioning | 22 |
| Workspace | 8 |
| Data source integration | 7 |
| Prometheus | 17 |
| Grafana | 26 |
| APM | 32 |
| RUM | 9 |
| Synthetics monitoring | 13 |
| Resource usage reports | 8 |
| Alerts | 15 |
| Notification channels | 3 |
| Event Center | 4 |
| Metric queries | 11 |
| Entity queries | 5 |
| UModel | 4 |
| Metadata | 3 |
| Tracing Analysis | 3 |
| Alibaba Cloud service activation | 2 |
| Tags | 3 |
| Resource groups | 1 |
Provisioning (integration)
CLI command | Description | Required API permissions |
| Retrieves add-on metadata, schemas, and alert code templates |
|
| Lists the catalog of installable add-ons |
|
| Creates an add-on release on an integration policy |
|
| Deletes an add-on release |
|
| Retrieves the details of an add-on release |
|
| Lists the add-on releases under an integration policy |
|
| Updates an add-on release |
|
| Runs a precheck on collector target connectivity and analyzes metrics |
|
| Performs service discovery and a relabel dry run for a deployed scrape configuration |
|
| Lists the collectors under an integration policy |
|
| Lists the custom scrape jobs under an integration policy |
|
| Lists the dashboards associated with an integration policy |
|
| Lists collection jobs or their scrape targets |
|
| Lists the PodMonitors under an integration policy |
|
| Creates an integration policy |
|
| Deletes an integration policy |
|
| Retrieves the details of an integration policy |
|
| Lists integration policies |
|
| Updates an integration policy |
|
| Lists the Kubernetes resources associated with an integration policy |
|
| Lists the ServiceMonitors under an integration policy |
|
| Lists the storage requirements of an integration policy |
|
Workspace (workspace)
CLI command | Description | Required API permissions |
| Deletes a UModel common schema reference |
|
| Lists UModel common schema references |
|
| Creates or updates a UModel common schema reference |
|
| Creates a CMS workspace and performs initialization of UModel and EntityStore |
|
| Deletes a CMS workspace |
|
| Retrieves the details of a CMS workspace |
|
| Lists CMS workspaces |
|
| Updates a CMS workspace |
|
Data source integration (datasource)
CLI command | Description | Required API permissions |
| Integrates a Prometheus instance, SLS Logstore, or MetricStore as a workspace UModel data source |
|
| Removes a data source from management and uninstalls the entity bundle instances on it |
|
| Installs one or all matching entity model bundles on a data source |
|
| Uninstalls an entity bundle installation record from a data source |
|
| Lists the entity bundle instances installed on a data source |
|
| Lists the available entity bundle templates |
|
| Lists the data sources integrated with a workspace |
|
Prometheus (prometheus)
CLI command | Description | Required API permissions |
| Creates a Prometheus instance |
|
| Deletes a Prometheus instance |
|
| Retrieves the details of a Prometheus instance, including the HTTP API endpoint |
|
| Lists Prometheus instances |
|
| Updates a Prometheus instance |
|
| Creates a pre-aggregation rule (Recording Rule / AggTaskGroup) |
|
| Deletes a pre-aggregation rule |
|
| Retrieves the details of a pre-aggregation rule |
|
| Lists pre-aggregation rules |
|
| Starts a pre-aggregation rule |
|
| Stops a pre-aggregation rule |
|
| Updates a pre-aggregation rule |
|
| Creates a Prometheus aggregate view |
|
| Deletes a Prometheus aggregate view |
|
| Retrieves a Prometheus aggregate view |
|
| Lists Prometheus aggregate views |
|
| Updates a Prometheus aggregate view |
|
Grafana (grafana)
CLI command | Description | Required API permissions |
| Grants an Alibaba Cloud account access to a Grafana workspace |
|
| Deletes a Grafana workspace account |
|
| Lists Grafana workspace accounts |
|
| Deletes the organization role of a Grafana workspace account |
|
| Adds or updates the organization role of a Grafana workspace account |
|
| Deletes a Grafana dashboard by UID |
|
| Retrieves the complete JSON of a Grafana dashboard by UID |
|
| Extracts the query statements of each panel in a dashboard |
|
| Reads a specified dashboard property by JSONPath |
|
| Searches Grafana dashboards by keyword |
|
| Retrieves a compact dashboard summary (title, variables, and panel overview) |
|
| Creates or updates a Grafana dashboard (full JSON or patch) |
|
| Creates a data source in a Grafana workspace |
|
| Deletes a Grafana data source |
|
| Retrieves the details of a Grafana data source |
|
| Checks the health status of a Grafana data source |
|
| Lists Grafana data sources |
|
| Updates a Grafana data source |
|
| Creates a Grafana folder |
|
| Deletes a Grafana folder |
|
| Searches Grafana folders by keyword |
|
| Creates a Grafana workspace |
|
| Deletes a Grafana workspace |
|
| Retrieves the details of a Grafana workspace |
|
| Lists Grafana workspaces |
|
| Updates a Grafana workspace |
|
APM (apm)
CLI command | Description | Required API permissions |
| Performs initialization of the APM observability infrastructure of a workspace (LicenseKey / endpoint) |
|
| Retrieves the APM observability configuration of a workspace |
|
| Updates the APM observability instance settings of a workspace |
|
| Creates a log correlation record for an APM application |
|
| Deletes the log correlation record of an APM application |
|
| Retrieves the log correlation record of an APM application |
|
| Lists the log correlation records in a workspace |
|
| Updates the log correlation record of an APM application |
|
| Retrieves the agent convergence configuration (SLS apm_convergence) |
|
| Partially updates agent convergence rules |
|
| Fully replaces the agent convergence configuration |
|
| Retrieves the business parameter extraction configuration (SLS apm_custom_extract) |
|
| Partially updates business parameter extraction rules |
|
| Fully replaces the business parameter extraction configuration |
|
| Retrieves the main agent configuration (sampling / Trace / Metrics / Profile) |
|
| Partially updates fields in the main agent configuration |
|
| Retrieves the data enrichment configuration (SLS apm_tag) |
|
| Partially updates the data enrichment configuration |
|
| Fully replaces the data enrichment configuration |
|
| Fully replaces the main agent configuration |
|
| Retrieves the custom monitored method configuration (SLS apm_user_method) |
|
| Partially updates the monitored method configuration |
|
| Fully replaces the monitored method configuration |
|
| Creates an APM application service |
|
| Deletes an APM application service |
|
| Retrieves the details of an APM application service |
|
| Lists the APM application services in a workspace |
|
| Creates a diagnostic task (such as HeapDump / LiveDebug) |
|
| Deletes a diagnostic task |
|
| Retrieves the details of a diagnostic task |
|
| Lists the diagnostic tasks of an application |
|
| Updates an APM application service |
|
RUM (rum)
CLI command | Description | Required API permissions |
| Performs initialization of the RUM observability infrastructure of a workspace |
|
| Retrieves the RUM observability configuration of a workspace |
|
| Updates the RUM observability instance settings of a workspace |
|
| Creates a RUM application service |
|
| Deletes a RUM application service |
|
| Retrieves the details of a RUM application service |
|
| Lists the RUM application services in a workspace |
|
| Updates a RUM application service |
|
| Uploads RUM symbol files (sourcemap / dSYM / ProGuard / native-symbol, and more) |
|
Synthetics monitoring (synthetics)
CLI command | Description | Required API permissions |
| Performs initialization of the resources required by Synthetics monitoring |
|
| Lists the regions available for internal detection |
|
| Lists the security groups available for internal detection |
|
| Lists the VPCs available for internal detection |
|
| Lists the vSwitches available for internal detection |
|
| Lists the detection point regions available for Synthetics monitoring |
|
| Creates a site monitoring task |
|
| Deletes a site monitoring task |
|
| Disables a site monitoring task |
|
| Enables a site monitoring task |
|
| Retrieves the details of a site monitoring task |
|
| Lists site monitoring tasks |
|
| Updates a site monitoring task |
|
Resource usage reports (resource-watermark)
CLI command | Description | Required API permissions |
| Downloads the file of a completed resource usage report task |
|
| Queries the cloud services and metric configurations supported by resource usage reports |
|
| Creates a resource usage report schedule |
|
| Deletes a resource usage report schedule |
|
| Lists resource usage report schedules |
|
| Modifies a resource usage report schedule |
|
| Lists resource usage report tasks |
|
| Triggers a one-off resource usage report task |
|
Alerts (alert)
CLI command | Description | Required API permissions |
| Queries CMS 2.0 alert history, with filters for workspace, critical level, status, and time range |
|
| Creates an alert rule (ManageAlertRules action=CREATE) |
|
| Deletes alert rules in batches by UUID |
|
| Disables alert rules in batches |
|
| Enables alert rules in batches |
|
| Retrieves the details of a single alert rule by UUID |
|
| Queries the list of alert rules in a workspace |
|
| Incrementally updates an alert rule (unspecified fields keep their server-side values) |
|
| Fully replaces an alert rule |
|
| Materializes an alert template into one or more alert rules |
|
| Creates a custom alert rule template |
|
| Deletes a custom alert rule template by ID |
|
| Retrieves an alert rule template by ID or UUID |
|
| Lists alert rule templates |
|
| Applies a field-level patch update to a custom alert rule template |
|
Notification channels (notification-channel)
CLI command | Description | Required API permissions |
| Lists alert contacts |
|
| Lists alert robots (DingTalk / Feishu / WeCom, and more) |
|
| Lists custom alert webhooks |
|
Event Center (event-hub)
CLI command | Description | Required API permissions |
| Queries the Logstore addressing of the four event types in a CMS 2.0 workspace |
|
| Retrieves the details of a single event by Event ID |
|
| Resolves the SLS destination of legacy CMS 1.0 events in the current account |
|
| Queries the event list from the SLS Event Store |
|
Metric queries (metric)
CLI command | Description | Required API permissions |
| Retrieves the cursor required by basic monitoring BatchExport |
|
| Batch exports basic monitoring time series data by cursor |
|
| Queries the latest data point of each time series (DescribeMetricLast) |
|
| Queries basic monitoring time series aggregated by time window (DescribeMetricList) |
|
| Performs a cross-series aggregate range query on basic monitoring data (DescribeMetricData) |
|
| Ranks the latest data points sorted by statistic value (DescribeMetricTop) |
|
| Passes through the Prometheus label-values API |
|
| Passes through the Prometheus labels API |
|
| Runs an instant PromQL query against a Prometheus instance |
|
| Runs a range PromQL query against a Prometheus instance |
|
| Finds time series by label matcher |
|
Entity queries (entity)
CLI command | Description | Required API permissions |
| Creates a health inspection rule group bound to an entity set |
|
| Deletes an entity health inspection rule group |
|
| Lists entity health inspection rule groups |
|
| Updates an entity health inspection rule group |
|
| Queries entity data from EntityStore or Resource Center CloudResource |
|
UModel (umodel)
CLI command | Description | Required API permissions |
| Retrieves UModel objects in a workspace by domain |
|
| Lists the UModel objects in a workspace |
|
| Queries UModel objects with EntityStore SPL |
|
| Writes (upserts) UModel objects through a YAML or JSON body |
|
Metadata (meta)
CLI command | Description | Required API permissions |
| Queries Cloud Monitor metric metadata (metric name, unit, and dimensions) |
|
| Lists the available Cloud Monitor namespaces and service codes |
|
| Lists the business regions available to the current account |
|
Tracing Analysis (trace)
CLI command | Description | Required API permissions |
| Runs an SLS SQL aggregate query on the Trace Logstore |
|
| Searches spans by SLS filter expression |
|
| Retrieves all spans by Trace ID and assembles the call tree |
|
Alibaba Cloud service activation (aliyun-service)
CLI command | Description | Required API permissions |
| Returns the activation or purchase page URL of a specified Alibaba Cloud service. For resource-center / resource-directory, returns console URLs only, without calling OpenAPI |
|
| Checks the activation status of services such as Prometheus, Hybrid Cloud Monitoring, Grafana, and Resource Center |
|
Resource groups (resource-group)
CLI command | Description | Required API permissions |
| Lists the resource groups in an account |
|
References
Cloud Monitor MCP: connects Cloud Monitor to MCP clients such as Cursor, Claude Code, or Lingma.
Configure credentials: describes how to manage the Alibaba Cloud CLI credentials that the
cms2plugin reuses.Cloud Monitor 2.0 RAM access policy reference: lists the system policies for Cloud Monitor 2.0.