This Skill is used to query monitoring time series data of Volcano Engine Cloud Monitor.
When to Use This Skill
When the user requests:
- When querying product monitoring data through Cloud Monitor
Main Features
1. Monitoring time series data query
- Full control over all parameters
- Flexible time range query
- Supports multiple monitoring metrics
- Queries the last 5 minutes of data by default
2. Configuration and invocation methods
- Supports environment variable configuration
AK/SK - Supports
.envfile configuration - Supports direct command-line use
- Supports Python code invocation
- Supports JSON format output
Processing Logic
Monitoring time series data query processing flow:
- Determine the product based on the instance information provided by the customer
- Identify the product type (ECS, Cloud Server, etc.)
- Determine the namespace based on the product
- Automatically map to the corresponding product namespace
- Determine metric_name/sub_namespace based on the monitoring metric
- Automatically determine based on monitoring metric keywords
- Query monitoring time series data in combination with dimension
- If no time range is specified, use the defaultfive minutesquery
Prerequisites
The Volcano Engine Python SDK needs to be installed:
pip install --upgrade "volcengine-python-sdk>=5.0.21"
Configuration Methods
You need to configure the Volcano Engine Access Key and Secret Key. It is recommended to use one of the following three methods:
Method 1: Environment variables
export VOLCENGINE_AK="your-ak"
export VOLCENGINE_SK="your-sk"
Method 2:.env file
In ~/.openclaw/workspace/.env configure:
VOLCENGINE_AK=your-ak
VOLCENGINE_SK=your-sk
Monitoring Parameter Description
Core parameters for monitoring time series data query
- namespace: Product namespace (e.g., VCM_ECS)
- metric_name: Monitoring metric name (e.g., DiskUsageUtilization)
- sub_namespace: Sub-namespace (e.g., Instance)
- dimension_name: Dimension name (e.g., ResourceID)
- dimension_value: Dimension value (e.g., instance ID)
- start_time: Start timestamp (optional, defaults to 5 minutes ago)
- end_time: End timestamp (optional, defaults to the current time)
- duration: Query duration (minutes, defaults to 5 minutes)
Monitoring time series data query parameter table
| Parameter | Abbreviation | Description | Required | Default Value |
|---|---|---|---|---|
--namespace |
-n |
Product namespace | Yes | - |
--metric-name |
-m |
Monitoring metric name | Yes | - |
--sub-namespace |
-s |
Sub-namespace | Yes | - |
--dimension-name |
-d |
Dimension name | Yes | - |
--dimension-value |
-v |
Dimension value | Yes | - |
--start-time |
- | Start timestamp | No | end_time - duration * 60 |
--end-time |
- | End timestamp | No | Current time |
--duration |
- | Query duration (minutes) | No | 5 |
--ak |
- | Access Key | No | Read from configuration |
--sk |
- | Secret Key | No | Read from configuration |
--region |
- | Region | No | cn-beijing |
--json |
- | Output in JSON format | No | False |
Time Parameter Description
- If you do not specify
--start-timeand--end-time, the default query is the most recent 5 minutesof data. - You can use the
--durationparameter to specify the query duration, in minutes. - The timestamp format is a Unix timestamp, in seconds.
How to Obtain Monitoring Parameters
1. Obtain the product namespace (namespace)
You can query the supported monitoring products through the following API:
curl 'https://cloudmonitor-api.console.volcengine.com/external/api/documents?Action=ListMetricProducts&Version=2018-01-01' \
-H 'Content-Type: application/json' \
--data-raw '{}'
2. Obtain monitoring metrics (metric_name / sub_namespace / dimension_name)
After determining the namespace , you can query the metric definitions for that product through the following API:
curl 'https://cloudmonitor-api.console.volcengine.com/external/api/documents?Action=ListMetricDocs&Version=2018-01-01' \
-H 'Content-Type: application/json' \
--data-raw '{"Namespace":"VCM_ECS"}'
Reference Materials
- Local reference documentation:
references/supported-cloud-products.md - Official page:
https://www.volcengine.com/docs/6408/1115078?lang=zh - Content description: includes the list of cloud products already integrated with Cloud Monitor, the corresponding
Namespaceand the monitoring data retention duration, to facilitate supplementing the product namespace information in the query parameters.
Usage Examples
Advanced Mode
Query a specified time range
python get_metric_data.py \
-n VCM_ECS \
-m DiskUsageUtilization \
-s Instance \
-d ResourceID \
-v i-yejc26eo744c5qwjqtgb \
--start-time 1632903801 \
--end-time 1632904801
Specify query duration (minutes)
python get_metric_data.py \
-n VCM_ECS \
-m DiskUsageUtilization \
-s Instance \
-d ResourceID \
-v i-yejc26eo744c5qwjqtgb \
--duration 30
API Description
GetMetricData
Query monitoring time series data
Parameters:
end_time: End timestamp (required)start_time: Start timestamp (required)namespace: Product namespace (required)metric_name: Monitoring metric name (required)sub_namespace: Sub-namespace (required)instances: Instance list, including dimension information (required)
Returns: Monitoring time series data
FAQ
Q: How do I get the current timestamp?
A: You can use Python to get the current Unix timestamp:
import time
current_timestamp = int(time.time())
print(current_timestamp)
Q: How do I query the monitoring data of other products?
A: First call ListMetricProducts to get all products, then call ListMetricDocs to get the specific metrics of the specified product.
Q: What is the timestamp format?
A: Use a Unix timestamp, in seconds. For example, 1632903801 represents a second-level point in time.
Q: What is the difference between Smart Mode and Advanced Mode?
A:
- Smart Mode: You only need to provide the product, monitoring metric, and instance ID, and the script will automatically infer the other parameters.
- Advanced Mode: You need to explicitly provide parameters such as
namespace、metric_name、sub_namespace, suitable for automation or precise control scenarios.