The tcb monitor command is available since v3.5.8.
CloudBase CLI provides a unified entry point for monitoring metrics queries, supporting Cloud Functions, Document Database, MySQL, CloudBase Run, Static Hosting, Authentication, AI Model, Knowledge Base, Gateway, User Login, DB Connector, and Environment QPS.
View Available Metrics Schema
View the list of monitoring metrics supported by each resource type.
tcb monitor schema [resource]
- If
resource is omitted, all resource types and their metrics are displayed
- If
resource is specified, only that type's metrics are displayed
Options
| Option | Description | Default |
|---|
resource | Resource type (optional), see table below | — |
Supported Resource Types
| Resource Type | Description |
|---|
function | Cloud Function |
database | Document Database |
mysql | MySQL Database |
cloudrun | CloudBase Run |
hosting | Static Hosting |
auth | Authentication |
ai | AI Model |
knowledgebase | Knowledge Base |
gateway | Gateway |
userlogin | User Login |
dbconnector | DB Connector |
env | Environment QPS |
Examples
tcb monitor schema
tcb monitor schema function
tcb monitor schema gateway
tcb monitor schema env
Cloud Function Monitoring
Query monitoring metrics for Cloud Functions.
tcb monitor function [function-name] [options]
- If
function-name is omitted, overview metrics for all functions are queried
Options
| Option | Description | Default |
|---|
function-name | Cloud Function name (optional) | — |
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor function
tcb monitor function helloWorld --metric-name FunctionInvocation
tcb monitor function helloWorld --since 1h --metric-name FunctionInvocation --metric-name FunctionFlux
tcb monitor function --since 7d --period 3600
tcb monitor function helloWorld --metric-name FunctionInvocation --json
Available Metrics
| Metric Name | Description |
|---|
FunctionCU | Resource usage |
FunctionInvocation | Invocation count |
FunctionFlux | Outbound traffic (KB) |
FunctionThrottle | Throttle count |
FunctionConcurrentExecutions | Concurrent executions |
FunctionTimeout | Timeout count |
FunctionGBs | Resource usage (Mb*Ms) |
FunctionError | Error count |
FunctionDuration | Execution duration (ms) |
FunctionConcurrencyMemoryMB | Concurrent execution memory |
FunctionMemOverFlow | Memory overflow count |
FunctionIdleProvisioned | Provisioned concurrency idle |
FunctionProvisionedConcurrency | Provisioned concurrency count |
Document Database Monitoring
Query monitoring metrics for the Document Database (NoSQL).
tcb monitor database [collection-name] [options]
- If
collection-name is omitted, overview metrics for all collections are queried
Options
| Option | Description | Default |
|---|
collection-name | Collection name (optional) | — |
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor database
tcb monitor database users --metric-name DbRead
tcb monitor database users --since 1h --metric-name DbRead --metric-name DbWrite
tcb monitor database --since 7d --period 3600
Available Metrics
| Metric Name | Description |
|---|
DbRead | Read request count |
DbWrite | Write request count |
DbCostTime10ms | Requests taking 10ms-50ms |
DbCostTime50ms | Requests taking 50ms-100ms |
DbCostTime100ms | Requests taking over 100ms |
DbSizepkg | Storage size (MB) |
MySQL Database Monitoring
Query monitoring metrics for MySQL databases.
tcb monitor mysql [options]
Options
| Option | Description | Default |
|---|
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor mysql
tcb monitor mysql --metric-name MysqlStorageUsage
tcb monitor mysql --metric-name MysqlCCU --since 1d
tcb monitor mysql --metric-name MysqlQps --metric-name MysqlSlowQueries
tcb monitor mysql --since 7d --period 3600
Available Metrics
| Metric Name | Description |
|---|
MysqlStorageUsage | Storage size (MB) |
MysqlCCU | CCU |
MysqlCpuUsageRate | CPU utilization |
MysqlDbConnections | Connection count |
MysqlMemoryUse | Memory usage (MB) |
MysqlSlowQueries | Slow query count |
MysqlTps | Transactions per second |
MysqlQps | Queries per second |
CloudBase Run Monitoring
Query monitoring metrics for CloudBase Run services.
tcb monitor cloudrun <service-name> [options]
service-name is required, specifying the CloudBase Run service name
Options
| Option | Description | Default |
|---|
service-name | CloudBase Run service name (required) | — |
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--service-version <serviceVersion> | Specify a service version to query metrics for that version | — |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor cloudrun my-service
tcb monitor cloudrun my-service --metric-name TkeQPSService
tcb monitor cloudrun my-service --metric-name TkeCpuUsedService --since 1d
tcb monitor cloudrun my-service --metric-name TkeQPSService --metric-name TkeRspTimeService
tcb monitor cloudrun my-service --service-version my-service-001
tcb monitor cloudrun my-service --since 7d --period 3600
Available Metrics
| Metric Name | Description |
|---|
TkeRspTimeService | Response time (ms) |
TkeCpuUsedService | CPU usage |
TkeMemUsedService | Memory usage |
TkeQPSService | QPS |
TkePodNumService | Instance count |
TkeHttpServiceNatPkg | Outbound traffic (byte) |
TkeCUUsedService | Memory usage (CU) |
TkeInvokeNumService | Invocation count |
TkeHttpErrorService | Error responses (404, 500, etc.) |
Static Hosting Monitoring
Query monitoring metrics for Static Hosting.
tcb monitor hosting [options]
Options
| Option | Description | Default |
|---|
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor hosting
tcb monitor hosting --metric-name StaticFsFluxPkg
tcb monitor hosting --metric-name StaticFsSizePkg
tcb monitor hosting --since 7d --period 86400
Available Metrics
| Metric Name | Description |
|---|
StaticFsFluxPkg | Traffic (byte) |
StaticFsSizePkg | Storage size (MB) |
Authentication Monitoring
Query monitoring metrics for Authentication.
tcb monitor auth [options]
Options
| Option | Description | Default |
|---|
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor auth
tcb monitor auth --since 7d --period 86400
tcb monitor auth --json
Available Metrics
| Metric Name | Description |
|---|
AuthInvocationNumPkg | Invocation count |
AI Model Monitoring
Query monitoring metrics for AI models.
Options
| Option | Description | Default |
|---|
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor ai
tcb monitor ai --metric-name AIPromptTokenNumPkg
tcb monitor ai --metric-name AICompletionTokenNumPkg
tcb monitor ai --since 7d --period 86400
Available Metrics
| Metric Name | Description |
|---|
AIPromptTokenNumPkg | Input Token |
AICompletionTokenNumPkg | Output Token |
AITotalTokenNumPkg | Total Token |
Knowledge Base Monitoring
Query monitoring metrics for the Knowledge Base.
tcb monitor knowledgebase [options]
Options
| Option | Description | Default |
|---|
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor knowledgebase
tcb monitor knowledgebase --since 7d --period 86400
tcb monitor knowledgebase --json
Available Metrics
| Metric Name | Description |
|---|
KnowledgeBaseCapacity | Capacity (bytes) |
Gateway Monitoring
Query monitoring metrics for the HTTP Gateway layer. Use the positional argument dimension to distinguish query dimensions: api (API call chain) and resource (HTTP request resource chain).
tcb monitor gateway <dimension> [options]
Options
| Option | Description | Default |
|---|
dimension | Query dimension (required). Options: api / resource | — |
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics for the current dimension are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--api-type <apiType> | Required when dimension=api. API type: wx (Mini Program API) or http_openapi (CloudBase API). Cannot be used with --resource-id | — |
--resource-id <resourceId> | Required when dimension=resource. Resource identifier in the format domain|:|route|:|resource-object. Cannot be used with --api-type | — |
--json | Output JSON, suitable for scripting | — |
- When
dimension=api, --api-type is required, and --resource-id is not supported
- When
dimension=resource, --resource-id is required, and --api-type is not supported
Examples
tcb monitor gateway api --api-type wx
tcb monitor gateway api --api-type http_openapi
tcb monitor gateway api --api-type http_openapi --since 6h
tcb monitor gateway resource --resource-id "example.com|:|/api/users|:|cloudfunction"
tcb monitor gateway api --api-type wx --json
Available Metrics (api dimension)
| Metric Name | Description |
|---|
GatewayShowAPIInvokeNum | Invocation count |
GatewayShowAPICostTotal | Average request duration |
GatewayShowAPIHTTP2XX | HTTP 2xx request count |
GatewayShowAPIHTTPError | HTTP ≥400 request count |
Available Metrics (resource dimension)
| Metric Name | Description |
|---|
GatewayShowHttpInvokeNum | Invocation count |
GatewayShowHttpCostTotal | Average request duration |
GatewayShowHttpHTTP2XX | HTTP 2xx request count |
GatewayShowHttpHTTPError | HTTP ≥400 request count |
User Login Monitoring
Query monitoring metrics for user login.
tcb monitor userlogin [options]
Options
| Option | Description | Default |
|---|
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor userlogin
tcb monitor userlogin --metric-name DayActiveLoginAllUser
tcb monitor userlogin --metric-name DayActiveLoginAnonymousUser --since 1d
tcb monitor userlogin --json
Available Metrics
| Metric Name | Description |
|---|
DayActiveLoginAnonymousUser | Anonymous user login DAU |
DayActiveLoginAllUser | All user login DAU |
DayActiveLoginExternalUser | External user login DAU |
DayActiveLoginInternalUser | Internal user login DAU |
DB Connector Monitoring
Query monitoring metrics for DB Connectors.
tcb monitor dbconnector <connector-id> [options]
connector-id is required, specifying the connector ID
Options
| Option | Description | Default |
|---|
connector-id | Connector ID (required) | — |
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor dbconnector my-connector-id
tcb monitor dbconnector my-connector-id --metric-name MongoConnectorRead
tcb monitor dbconnector my-connector-id --metric-name MongoConnectorInvokeNum --since 30m
tcb monitor dbconnector my-connector-id --json
Available Metrics
| Metric Name | Description |
|---|
MongoConnectorRead | Read request count |
MongoConnectorWrite | Write request count |
MongoConnectorCostTime10ms | Requests taking 10ms-50ms |
MongoConnectorCostTime50ms | Requests taking 50ms-100ms |
MongoConnectorCostTime100ms | Requests taking over 100ms |
MongoConnectorInvokeNum | Invocation count |
Environment QPS Monitoring
Query monitoring metrics for environment QPS.
tcb monitor env [options]
Options
| Option | Description | Default |
|---|
-e, --env-id <envId> | Environment ID (interactive selection if omitted) | — |
--since <since> | Start time, supports relative time format (e.g., 30s, 30m, 1h, 2d) | 1h |
--until <until> | End time, supports relative time format (e.g., now, 5m) | now |
--metric-name <metricName...> | Specify metric names to query. If omitted, all metrics are queried. Multiple metrics can be comma-separated or repeated | All metrics |
--period <period> | Statistics period in seconds: 300 (5 min), 3600 (1 hour), 86400 (1 day). Auto-selected if omitted | Auto |
--json | Output JSON, suitable for scripting | — |
Examples
tcb monitor env
tcb monitor env --metric-name EnvQPSAll
tcb monitor env --since 1h
tcb monitor env --since 7d --period 3600
tcb monitor env --json
Available Metrics
| Metric Name | Description |
|---|
EnvQPSAll | Total environment QPS |