Skip to main content
Glama
aliyun

AlibabaCloud MCP Server

Official
by aliyun

GetCpuloadavg5mData

Retrieve CPU load average over 5 minutes for AlibabaCloud ECS instances. Monitor system performance and manage resource usage effectively with automated data collection.

Instructions

获取CPU五分钟平均负载指标数据

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
InstanceIdsYesAlibabaCloud ECS instance ID List
RegionIdNoAlibabaCloud region IDcn-hangzhou

Implementation Reference

  • The handler function CMS_GetCpuloadavg5mData retrieves the latest CPU 5-minute average load metric data for specified Alibaba Cloud ECS instances using the CMS DescribeMetricLast API.
    @tools.append def CMS_GetCpuloadavg5mData( InstanceIds: List[str] = Field(description='AlibabaCloud ECS instance ID List'), RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou') ): """获取CPU五分钟平均负载指标数据""" return _get_cms_metric_data(RegionId, InstanceIds, 'load_5m')
  • Helper function that fetches the latest metric data from Alibaba Cloud CMS for given instance IDs and metric name (e.g., 'load_5m' for CPU 5m load avg).
    def _get_cms_metric_data(region_id: str, instance_ids: List[str], metric_name: str): client = create_client(region_id) dimesion = [] for instance_id in instance_ids: dimesion.append({ 'instanceId': instance_id }) describe_metric_last_request = cms_20190101_models.DescribeMetricLastRequest( namespace='acs_ecs_dashboard', metric_name=metric_name, dimensions=json.dumps(dimesion), ) describe_metric_last_resp = client.describe_metric_last(describe_metric_last_request) logger.info(f'CMS Tools response: {describe_metric_last_resp.body}') return describe_metric_last_resp.body.datapoints
  • Loop that registers all tools from cms_tools.tools (including CMS_GetCpuloadavg5mData) into the FastMCP server instance.
    for tool in cms_tools.tools: mcp.tool(tool)
  • Decorator that appends the CMS_GetCpuloadavg5mData function to the cms_tools.tools list, which is later registered in the MCP server.
    @tools.append

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-core-mcp-server'

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