Skip to main content
Glama
aliyun

Alibaba Cloud RDS OpenAPI MCP Server

Official
by aliyun

describe_monitor_metrics

Query detailed performance and diagnostic metrics, including IOPSUsage and DiskUsage, for a specific Alibaba Cloud RDS instance. Specify time range and metrics to monitor database health and performance effectively.

Instructions

Queries performance and diagnostic metrics for an instance using the DAS (Database Autonomy Service) API. This method provides extra monitoring and diagnostic data which cannot be queried by describe_db_instance_performance, such as IOPSUsage, MdlLockSession, etc. Args: dbinstance_id (str): The ID of the RDS instance. metrics_list (list[str]): The metrics to query. (e.g. ["IOBytesPS", "IOPSUsage", "MdlLockSession", "DiskUsage"]) db_type (str): The type of the database. (e.g. "mysql") start_time(str): the start time. e.g. 2025-06-06 20:00:00 end_time(str): the end time. e.g. 2025-06-06 20:10:00 Returns: the monitor metrics information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
db_typeYes
dbinstance_idYes
end_timeYes
metrics_listYes
start_timeYes

Implementation Reference

  • The core handler function for the 'describe_monitor_metrics' tool. It fetches performance and diagnostic metrics (e.g., IOPSUsage, DiskUsage) from Alibaba Cloud's DAS service for a given RDS instance over a specified time range, transforming and formatting the data into a markdown table.
    async def describe_monitor_metrics( dbinstance_id: str, metrics_list: list[str], db_type: str, start_time: str, end_time: str, ): """ Queries performance and diagnostic metrics for an instance using the DAS (Database Autonomy Service) API. This method provides extra monitoring and diagnostic data which cannot be queried by describe_db_instance_performance, such as IOPSUsage, MdlLockSession, etc. Args: dbinstance_id (str): The ID of the RDS instance. metrics_list (list[str]): The metrics to query. (e.g. ["IOBytesPS", "IOPSUsage", "MdlLockSession", "DiskUsage"]) db_type (str): The type of the database. (e.g. "mysql") start_time(str): the start time. e.g. 2025-06-06 20:00:00 end_time(str): the end time. e.g. 2025-06-06 20:10:00 Returns: the monitor metrics information. """ try: # Initialize client client = get_das_client() metrics = transform_das_key(db_type, metrics_list) if not metrics: raise OpenAPIError(f"Unsupported das_metric_key: {metrics_list}") start_time = convert_datetime_to_timestamp(start_time) end_time = convert_datetime_to_timestamp(end_time) # 通过 interval 控制查询粒度 interval = int(max((end_time - start_time) / 30000, 5)) body = { "InstanceId": dbinstance_id, "Metrics": ",".join(metrics), "StartTime": start_time, "EndTime": end_time, "Interval": interval } req = open_api_models.OpenApiRequest( query=OpenApiUtilClient.query({}), body=OpenApiUtilClient.parse_to_map(body) ) params = open_api_models.Params( action='GetPerformanceMetrics', version='2020-01-16', protocol='HTTPS', pathname='/', method='POST', auth_type='AK', style='RPC', req_body_type='formData', body_type='json' ) response = client.call_api(params, req, util_models.RuntimeOptions()) response_data = response['body']['Data'] timestamp_map = {} resp_metrics_list = set() for metric in response_data: name = metric["Name"] values = metric["Value"] timestamps = metric["Timestamp"] resp_metrics_list.add(name) for timestamp, value in zip(timestamps, values): dt = transform_timestamp_to_datetime(timestamp) if dt not in timestamp_map: timestamp_map[dt] = {} timestamp_map[dt][name] = value headers = sorted(list(resp_metrics_list)) datas = [] for dt in sorted(timestamp_map.keys()): value_map = timestamp_map[dt] value_map["datetime"] = dt datas.append(value_map) headers.insert(0, "datetime") return json_array_to_markdown(headers, datas) except Exception as e: logger.error(f"Error occurred: {str(e)}") raise e

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aliyun/alibabacloud-rds-openapi-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server