
Byted Volcengine Cloudmonitor
- 7 installs
- 411 repo stars
- Updated August 4, 2026
- bytedance/agentkit-samples
byted-volcengine-cloudmonitor is a Claude skill that queries time-series monitoring data from Volcengine CloudMonitor using the Volcengine Python SDK.
About
This skill queries time-series monitoring data from Volcengine CloudMonitor. It maps a product to its namespace, resolves metric name, sub-namespace, and dimension, then fetches metric data via GetMetricData, defaulting to the last 5 minutes. A developer uses it to read cloud resource metrics such as ECS disk usage through the Volcengine Python SDK.
- Queries Volcengine CloudMonitor metric time-series
- Maps products to namespace/metric/dimension automatically
- Defaults to the last 5 minutes of data
Byted Volcengine Cloudmonitor by the numbers
- 7 all-time installs (skills.sh)
- Ranked #865 of 1,039 Cloud & Infrastructure skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
byted-volcengine-cloudmonitor capabilities & compatibility
Requires Volcengine AK/SK; installs volcengine-python-sdk>=5.0.21.
- Use cases
- data analysis · devops
- Runs
- Runs locally
- Pricing
- Bring your own API key
What byted-volcengine-cloudmonitor says it does
description: 火山引擎云监控技能,用于查询云资源的监控时序数据。
pip install --upgrade "volcengine-python-sdk>=5.0.21"
npx skills add https://github.com/bytedance/agentkit-samples --skill byted-volcengine-cloudmonitorAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 7 |
|---|---|
| repo stars | ★ 411 |
| Last updated | August 4, 2026 |
| Repository | bytedance/agentkit-samples ↗ |
What it does
Query Volcengine CloudMonitor time-series metrics for cloud resources like ECS.
Who is it for?
Reading Volcengine cloud resource metric time-series such as ECS disk usage.
When should I use this skill?
Use when querying monitoring time-series data for a Volcengine cloud product.
By the numbers
- default query window 5 minutes
- requires volcengine-python-sdk>=5.0.21
- region default cn-beijing
Files
火山引擎云监控 Skill
这个 Skill 用于查询火山引擎云监控的监控时序数据。
何时使用此 Skill
当用户要求:
- 通过云监控查询产品监控数据的时候
主要功能
1. 监控时序数据查询
- 完全控制所有参数
- 灵活的时间范围查询
- 支持多种监控指标
- 默认查询最近 5 分钟数据
2. 配置与调用方式
- 支持环境变量配置
AK/SK - 支持
.env文件配置 - 支持命令行直接使用
- 支持 Python 代码调用
- 支持 JSON 格式输出
处理逻辑
监控时序数据查询处理流程:
1. 根据客户提供的实例信息确定产品
- 识别产品类型(ECS、云服务器等)
2. 通过产品确定 namespace
- 自动映射到对应的产品命名空间
3. 通过监控指标确定 metric\_name/sub\_namespace
- 根据监控指标关键词自动确定
4. 结合 dimension 查询监控时序数据
- 如果没有指定时间范围,则按照默认五分钟查询
前置要求
需要安装火山引擎 Python SDK:
pip install --upgrade "volcengine-python-sdk>=5.0.21"配置方式
需要配置火山引擎的 Access Key 和 Secret Key。推荐使用以下三种方式之一:
方式 1:环境变量
export VOLCENGINE_AK="your-ak"
export VOLCENGINE_SK="your-sk"方式 2:.env 文件
在 ~/.openclaw/workspace/.env 中配置:
VOLCENGINE_AK=your-ak
VOLCENGINE_SK=your-sk监控参数说明
监控时序数据查询核心参数
- namespace: 产品命名空间(如 VCM\_ECS)
- metric\_name: 监控指标名称(如 DiskUsageUtilization)
- sub\_namespace: 子命名空间(如 Instance)
- dimension\_name: 维度名称(如 ResourceID)
- dimension\_value: 维度值(如实例 ID)
- start\_time: 开始时间戳(可选,默认 5 分钟前)
- end\_time: 结束时间戳(可选,默认当前时间)
- duration: 查询时长(分钟,默认 5 分钟)
监控时序数据查询参数表
| 参数 | 简写 | 说明 | 必填 | 默认值 |
|---|---|---|---|---|
--namespace | -n | 产品命名空间 | 是 | - |
--metric-name | -m | 监控指标名称 | 是 | - |
--sub-namespace | -s | 子命名空间 | 是 | - |
--dimension-name | -d | 维度名称 | 是 | - |
--dimension-value | -v | 维度值 | 是 | - |
--start-time | - | 开始时间戳 | 否 | end_time - duration * 60 |
--end-time | - | 结束时间戳 | 否 | 当前时间 |
--duration | - | 查询时长(分钟) | 否 | 5 |
--ak | - | Access Key | 否 | 从配置读取 |
--sk | - | Secret Key | 否 | 从配置读取 |
--region | - | 区域 | 否 | cn-beijing |
--json | - | 以 JSON 格式输出 | 否 | False |
时间参数说明
- 如果不指定
--start-time和--end-time,默认查询最近 5 分钟的数据。 - 可以使用
--duration参数指定查询时长,单位为分钟。 - 时间戳格式为 Unix 时间戳,单位为秒。
如何获取监控参数
1. 获取产品命名空间(namespace)
可通过以下接口查询支持的监控产品:
curl 'https://cloudmonitor-api.console.volcengine.com/external/api/documents?Action=ListMetricProducts&Version=2018-01-01' \
-H 'Content-Type: application/json' \
--data-raw '{}'2. 获取监控指标(metric\_name / sub\_namespace / dimension\_name)
在确定 namespace 后,可通过以下接口查询该产品的指标定义:
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"}'参考资料
- 本地参考文档:
references/supported-cloud-products.md - 官方页面:
https://www.volcengine.com/docs/6408/1115078?lang=zh - 内容说明:收录云监控已接入的云产品列表、对应
Namespace和监控数据保存时长,便于补充查询参数中的产品命名空间信息。
使用示例
高级模式
指定时间范围查询
python get_metric_data.py \
-n VCM_ECS \
-m DiskUsageUtilization \
-s Instance \
-d ResourceID \
-v i-yejc26eo744c5qwjqtgb \
--start-time 1632903801 \
--end-time 1632904801指定查询时长(分钟)
python get_metric_data.py \
-n VCM_ECS \
-m DiskUsageUtilization \
-s Instance \
-d ResourceID \
-v i-yejc26eo744c5qwjqtgb \
--duration 30API 说明
GetMetricData
查询监控时序数据
参数:
end_time: 结束时间戳(必填)start_time: 开始时间戳(必填)namespace: 产品命名空间(必填)metric_name: 监控指标名称(必填)sub_namespace: 子命名空间(必填)instances: 实例列表,包含维度信息(必填)
返回: 监控时序数据
常见问题
Q: 如何获取当前时间戳?
A: 可以使用 Python 获取当前 Unix 时间戳:
import time
current_timestamp = int(time.time())
print(current_timestamp)Q: 如何查询其他产品的监控数据?
A: 先调用 ListMetricProducts 获取所有产品,再调用 ListMetricDocs 获取指定产品的具体指标。
Q: 时间戳格式是什么?
A: 使用 Unix 时间戳,单位为秒。例如 1632903801 表示一个秒级时间点。
Q: 智能模式和高级模式有什么区别?
A:
- 智能模式:只需提供产品、监控指标和实例 ID,脚本会自动推导其他参数。
- 高级模式:需要显式提供
namespace、metric_name、sub_namespace等参数,适合自动化或精确控制场景。
支持的云产品
- 来源页面:支持的云产品
- 页面主题:云监控已接入的云产品、对应
Namespace与监控数据保存时长 - 页面更新时间:
2026.03.09 11:24:59
页面说明
支持的云产品如下。云产品已接入云监控服务,当您使用该云产品后,系统会自动开启该产品的监控,并上报监控指标。
云产品列表
| 产品分类 | 产品名称 | Namespace | 数据保存时长(天) |
|---|---|---|---|
| 弹性计算 | 云服务器 | VCM_ECS | 60 |
| 弹性计算 | 专有宿主机 | VCM_DDH | 60 |
| 弹性计算 | AgentKit-MCP服务 | VCM_AgentKitMcp | 30 |
| 弹性计算 | AgentKit-智能体运行时 | VCM_AgentKitRuntime | 30 |
| 弹性计算 | AgentKit-工具 | VCM_AgentKitSandboxTool | 30 |
| 弹性计算 | AgentKit-MCP工具集 | VCM_AgentKitMcpToolset | 30 |
| 容器 | 容器服务 | VCM_VKE | 30 |
| CDN 与加速 | 内容分发网络 | VCM_CDN | 30 |
| CDN 与加速 | 全站加速 | VCM_DCDN | 30 |
| CDN 与加速 | 全球加速 | VCM_GA | 30 |
| CDN 与加速 | 边缘联网 SD-WAN | VCM_SDWAN | 30 |
| CDN 与加速 | 边缘计算-边缘智能 | VCM_VEI | 30 |
| 视频云 | 视频点播 | VCM_VOD | 30 |
| 视频云 | 视频点播-CDN | VCM_VODCDN | 30 |
| 视频云 | veImageX | VCM_veImageX | 30 |
| 视频云 | 视频直播 | VCM_LIVE | 60 |
| Serverless | 函数服务 | VCM_veFaaS | 30 |
| 数据库 | 数据库传输服务 DTS | VCM_DTS | 30 |
| 数据库 | 表格数据库 HBase 版 | VCM_HBase | 30 |
| 数据库 | 表格数据库 HBase 版-多可用区 | VCM_MultiazHBase | 30 |
| 数据库 | 文档数据库 MongoDB 版-副本集 | VCM_MongoDB_Replica | 30 |
| 数据库 | 文档数据库 MongoDB 版-分片集 | VCM_MongoDB_Sharded_Cluster | 30 |
| 数据库 | 云数据库 MySQL Sharding 版 | VCM_MySQL_Sharding | 30 |
| 数据库 | 云数据库 MySQL 版 | VCM_RDS_MySQL | 30 |
| 数据库 | 云数据库 PostgreSQL 版 | VCM_RDS_PostgreSQL | 30 |
| 数据库 | 云数据库 RDS SQL Server 版 | VCM_RDS_SQLServer | 30 |
| 数据库 | 云数据库 veDB MySQL 版 | VCM_veDB_MySQL | 30 |
| 数据库 | 缓存数据库 Redis 版-社区版 | VCM_Redis | 30 |
| 数据库 | 缓存数据库 Redis 版-企业版 | VCM_Redis_Enterprise | 30 |
| 数据库 | 图数据库 veGraph | VCM_veGraph_db | 30 |
| 存储 | 大数据文件存储 | VCM_CFS | 30 |
| 存储 | 弹性块存储 | VCM_EBS | 60 |
| 存储 | 半托管文件缓存 SFCS | VCM_SFCS | 30 |
| 存储 | 文件存储 NAS 极速型 | VCM_FileNAS | 30 |
| 存储 | 文件存储 NAS 容量型 | VCM_veFileNAS | 30 |
| 存储 | 文件存储 NAS 缓存型 | VCM_veFileNAS_Cache | 30 |
| 存储 | 文件存储 vePFS | VCM_vePFS | 90 |
| 存储 | 对象存储 | VCM_TOS | 60 |
| 存储 | 日志服务 | VCM_TLS | 30 |
| 中间件 | 云原生消息引擎 | VCM_BMQ | 30 |
| 中间件 | 云搜索服务 | VCM_ESCloud | 30 |
| 中间件 | 云搜索服务 Serverless 版 | VCM_ESCloud_Serverless | 30 |
| 中间件 | 配置中心-Etcd | VCM_ConfigCenter_Etcd | 30 |
| 中间件 | 配置中心-Zookeeper | VCM_ConfigCenter_ZooKeeper | 30 |
| 中间件 | 托管 Prometheus | VCM_Prometheus | 30 |
| 中间件 | 消息队列 Kafka 版 | VCM_Kafka | 30 |
| 中间件 | 消息队列 RabbitMQ 版 | VCM_RabbitMQ | 30 |
| 中间件 | 消息队列 RocketMQ 版 | VCM_RocketMQ | 30 |
| 网络 | 应用型负载均衡 | VCM_ALB | 60 |
| 网络 | Anycast 公网IP | VCM_AnycastEIP | 30 |
| 网络 | 共享带宽包 | VCM_BandwidthPackage | 60 |
| 网络 | 云企业网 | VCM_CEN | 30 |
| 网络 | 负载均衡 | VCM_CLB | 60 |
| 网络 | 负载均衡独占集群 | VCM_CLB_EC | 30 |
| 网络 | 云连接器 | VCM_CloudConnector | 30 |
| 网络 | 专线连接-物理专线 | VCM_DirectConnectConnection | 30 |
| 网络 | 专线连接-专线网关 | VCM_DirectConnectGateway | 30 |
| 网络 | 专线连接-虚拟接口 | VCM_DirectConnectVIF | 30 |
| 网络 | 公网 IP | VCM_EIP | 60 |
| 网络 | 网际快车 | VCM_Fasttrack | 30 |
| 网络 | IPsec 连接 | VCM_IPsec | 30 |
| 网络 | 互联网通道-公网带宽 | VCM_InternetTunnelBandwidth | 30 |
| 网络 | 互联网通道虚拟接口 | VCM_InternetTunnelVirtualInterface | 30 |
| 网络 | Vortex IP | VCM_Vortex_IP | 30 |
| 网络 | 字节互联服务-网络 | VCM_BIS | 30 |
| 网络 | IPV6 公网带宽 | VCM_Ipv6AddressBandwidth | 30 |
| 网络 | IPV6 网关 | VCM_Ipv6Gateway | 30 |
| 网络 | NAT 网关 | VCM_NAT | 30 |
| 网络 | NAT64 网关 | VCM_NAT64 | 30 |
| 网络 | 私网连接-终端节点 | VCM_PrivateLinkEndpoint | 30 |
| 网络 | 私网连接-终端节点服务 | VCM_PrivateLinkEndpointService | 30 |
| 网络 | 私网连接-私网连接网关 | VCM_PrivateLinkGateway | 30 |
| 网络 | 私网 NAT 网关 | VCM_PrivateNAT | 30 |
| 网络 | 中转路由器 | VCM_TransitRouter | 30 |
| 网络 | 中转路由器带宽包 | VCM_TransitRouterBandwidthPackage | 30 |
| 网络 | VPN 连接 | VCM_VPN | 30 |
| 数据中台 | ByteHouse 云数仓版 | VCM_ByteHouse | 30 |
| 数据中台 | ByteHouse 企业版 | VCM_ByteHouse_Ce | 30 |
| 数据中台 | ByteHouse 云数仓版 - 数据导入 | VCM_ByteHouse_DataLoading | 30 |
| 数据中台 | 大数据研发治理套件 | VCM_DataLeap | 30 |
| 数据中台 | 全域数据集成 | VCM_DataSail | 30 |
| 数据中台 | 全域数据集成-资源组 | VCM_DataSail_ResourceGroup | 30 |
| 数据中台 | 全域数据集成-采集Topic | VCM_DataSail_Topic | 30 |
| 数据中台 | E-MapReduce | VCM_EMR | 30 |
| 数据中台 | E-MapReduce on VKE | VCM_EMR_ON_VKE | 30 |
| 数据中台 | E-MapReduce StarRocks | VCM_EMR_StarRocks | 30 |
| 数据中台 | 流式计算 Flink 版 | VCM_Flink | 30 |
| 数据中台 | 批式计算 Spark 版 | VCM_Spark | 30 |
| 数据中台 | 湖仓一体分析服务 | VCM_LAS | 30 |
| 安全 | DDoS 高防 | VCM_Adv_DDoS_Protection | 30 |
| 安全 | DDoS 高防-域名 | VCM_Adv_DDoS_Protection_Domain | 30 |
| 研发中台 | 物联网平台 | VCM_IoT | 30 |
| 人工智能与算法 | 向量数据库 | VCM_VikingDB | 30 |
| 域名与网站 | TrafficRoute-移动解析HTTPDNS | VCM_TrafficRoute_HTTPDNS | 30 |
备注
- 本文件用于在仓库内保留页面内容的 Markdown 版本,便于离线查阅和引用。
- 若后续官方页面更新,请以来源页面为准,并按需重新同步本文件。
#!/usr/bin/env python3
from __future__ import print_function
import argparse
from datetime import datetime
import json
import os
import time
def _format_timestamp(timestamp):
"""将 Unix 秒级时间戳转换为本地可读时间。"""
return datetime.fromtimestamp(int(timestamp)).strftime("%Y-%m-%d %H:%M:%S")
def _decorate_response(resp):
"""为 CloudMonitor 返回结果补充可读时间字段,便于直接查看。"""
if hasattr(resp, "to_dict"):
data = resp.to_dict()
else:
data = resp
if not isinstance(data, dict):
return data
payload = data.get("data")
if not isinstance(payload, dict):
return data
start_time = payload.get("start_time")
end_time = payload.get("end_time")
if start_time is not None:
payload["start_time_readable"] = _format_timestamp(start_time)
if end_time is not None:
payload["end_time_readable"] = _format_timestamp(end_time)
for series in payload.get("metric_data_results", []) or []:
for point in series.get("data_points", []) or []:
timestamp = point.get("timestamp")
if timestamp is not None:
point["time"] = _format_timestamp(timestamp)
return data
def _read_env_file(path):
result = {}
if not os.path.exists(path):
return result
try:
with open(path, "r", encoding="utf-8") as f:
for raw in f:
line = raw.strip()
if not line or line.startswith("#") or "=" not in line:
continue
k, v = line.split("=", 1)
result[k.strip()] = v.strip()
except Exception:
pass
return result
def _load_credentials(args):
ak = args.ak or os.getenv("VOLCENGINE_AK", "")
sk = args.sk or os.getenv("VOLCENGINE_SK", "")
region = args.region or os.getenv("VOLCENGINE_REGION", "cn-beijing")
if not ak or not sk:
env_map = _read_env_file(os.path.expanduser("~/.openclaw/workspace/.env"))
ak = ak or env_map.get("VOLCENGINE_AK", "")
sk = sk or env_map.get("VOLCENGINE_SK", "")
if not ak or not sk:
config_path = os.path.expanduser("~/.volcengine/config.json")
if os.path.exists(config_path):
try:
with open(config_path, "r", encoding="utf-8") as f:
cfg = json.load(f)
ak = ak or cfg.get("ak", "")
sk = sk or cfg.get("sk", "")
region = region if region != "cn-beijing" else cfg.get("region", region)
except Exception:
pass
if not ak or not sk:
raise RuntimeError("未配置 AK/SK,请通过 --ak/--sk、环境变量 VOLCENGINE_ACCESS_KEY/SECRET_KEY 或 .env 文件提供。")
return ak, sk, region
def main():
parser = argparse.ArgumentParser(description="火山引擎云监控 - 查询监控时序数据")
parser.add_argument("--namespace", "-n", required=True, help="产品命名空间(如 VCM_ECS)")
parser.add_argument("--metric-name", "-m", required=True, help="监控指标名称(如 CPUUtilization)")
parser.add_argument("--sub-namespace", "-s", required=True, help="子命名空间(如 Instance)")
parser.add_argument("--dimension-name", "-d", required=True, help="维度名称(如 ResourceID)")
parser.add_argument("--dimension-value", "-v", required=True, help="维度值(如实例 ID)")
parser.add_argument("--start-time", type=int, help="开始时间戳(Unix 秒)")
parser.add_argument("--end-time", type=int, help="结束时间戳(Unix 秒)")
parser.add_argument("--duration", type=int, default=5, help="查询时长(分钟,默认 5)")
parser.add_argument("--ak", help="Access Key")
parser.add_argument("--sk", help="Secret Key")
parser.add_argument("--region", default="cn-beijing", help="区域(默认 cn-beijing)")
parser.add_argument("--json", action="store_true", help="以 JSON 格式输出")
args = parser.parse_args()
import volcenginesdkcore
import volcenginesdkvolcobserve
from volcenginesdkcore.rest import ApiException
ak, sk, region = _load_credentials(args)
configuration = volcenginesdkcore.Configuration()
configuration.ak = ak
configuration.sk = sk
configuration.region = region
volcenginesdkcore.Configuration.set_default(configuration)
api_instance = volcenginesdkvolcobserve.VOLCOBSERVEApi()
now = int(time.time())
end_time = args.end_time if args.end_time is not None else now
start_time = args.start_time if args.start_time is not None else (end_time - args.duration * 60)
req_dimensions = volcenginesdkvolcobserve.DimensionForGetMetricDataInput(
name=args.dimension_name,
value=args.dimension_value,
)
req_instances = volcenginesdkvolcobserve.InstanceForGetMetricDataInput(
dimensions=[req_dimensions],
)
request = volcenginesdkvolcobserve.GetMetricDataRequest(
end_time=end_time,
instances=[req_instances],
metric_name=args.metric_name,
namespace=args.namespace,
start_time=start_time,
sub_namespace=args.sub_namespace,
)
try:
resp = api_instance.get_metric_data(request)
decorated_resp = _decorate_response(resp)
if args.json:
print(json.dumps(decorated_resp, indent=2, ensure_ascii=False))
else:
payload = decorated_resp.get("data", {}) if isinstance(decorated_resp, dict) else {}
print("=" * 60)
print("CloudMonitor 监控时序数据")
print("=" * 60)
print(f"namespace: {args.namespace}")
print(f"metric_name: {args.metric_name}")
print(f"sub_namespace: {args.sub_namespace}")
print(f"{args.dimension_name}: {args.dimension_value}")
print(f"time_range: {_format_timestamp(start_time)} ~ {_format_timestamp(end_time)}")
print("=" * 60)
for series in payload.get("metric_data_results", []) or []:
print(f"legend: {series.get('legend', '-')}")
for point in series.get("data_points", []) or []:
print(f"{point.get('time', '-')} value={point.get('value')}")
print("-" * 60)
except ApiException as e:
print(f"CloudMonitor GetMetricData 调用失败: {e}")
raise SystemExit(2)
if __name__ == "__main__":
main()
Related skills
FAQ
What is the default time window?
If start-time and end-time are not specified, it queries the last 5 minutes of data.
What credentials are needed?
Volcengine AK/SK via environment variables or a .env file, plus the volcengine-python-sdk.