RebootRDSInstances
Restart multiple AlibabaCloud RDS instances simultaneously to manage and resolve performance issues efficiently. Ideal for bulk instance maintenance and optimization.
Instructions
批量重启RDS实例,适用于需要同时管理和重启多台RDS实例的场景。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| InstanceIds | Yes | AlibabaCloud RDS instance ID List | |
| RegionId | No | AlibabaCloud region ID | cn-hangzhou |
Implementation Reference
- The handler function for the 'OOS_RebootRDSInstances' tool, which reboots multiple Alibaba Cloud RDS instances using OOS execution template 'ACS-RDS-BulkyRestartInstances'. Includes input schema via Pydantic Fields.@tools.append def OOS_RebootRDSInstances( InstanceIds: List[str] = Field(description='AlibabaCloud RDS instance ID List'), RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou') ): """批量重启RDS实例,适用于需要同时管理和重启多台RDS实例的场景。""" parameters = { 'regionId': RegionId, 'resourceType': 'ALIYUN::RDS::Instance', 'targets': { 'ResourceIds': InstanceIds, 'RegionId': RegionId, 'Type': 'ResourceIds' } } return _start_execution_sync(region_id=RegionId, template_name='ACS-RDS-BulkyRestartInstances', parameters=parameters)
- src/alibaba_cloud_ops_mcp_server/server.py:82-83 (registration)Registration of all OOS tools, including 'OOS_RebootRDSInstances', into the FastMCP server using mcp.tool().for tool in oos_tools.tools: mcp.tool(tool)
- Helper function that starts an OOS execution and polls until completion or failure, used by all OOS tools including RebootRDSInstances.def _start_execution_sync(region_id: str, template_name: str, parameters: dict): client = create_client(region_id=region_id) start_execution_request = oos_20190601_models.StartExecutionRequest( region_id=region_id, template_name=template_name, parameters=json.dumps(parameters) ) start_execution_resp = client.start_execution(start_execution_request) execution_id = start_execution_resp.body.execution.execution_id while True: list_executions_request = oos_20190601_models.ListExecutionsRequest( region_id=region_id, execution_id=execution_id ) list_executions_resp = client.list_executions(list_executions_request) status = list_executions_resp.body.executions[0].status if status == FAILED: status_message = list_executions_resp.body.executions[0].status_message raise exception.OOSExecutionFailed(reason=status_message) elif status in END_STATUSES: return list_executions_resp.body time.sleep(1) @tools.append
- Helper function to create OOS client configured for the given region.def create_client(region_id: str) -> oos20190601Client: config = create_config() config.endpoint = f'oos.{region_id}.aliyuncs.com' return oos20190601Client(config)