调用DescribeInvocationResults查看一条或多条云助手命令的执行结果,即在ECS实例中的实际执行结果。
接口说明
- 当您执行命令后,不代表命令一定成功执行,并且一定有预期的命令效果。您需要通过本接口查看实际的具体执行结果,以实际输出结果为准。
- 您可以查询最近2周的执行信息,执行信息的保留上限为10万条。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | DescribeInvocationResults | 系统规定参数。取值:DescribeInvocationResults |
| RegionId | String | 是 | cn-hangzhou | 地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。 |
| InvokeId | String | 否 | t-hz0jdfwd9f**** | 命令执行ID。您可以通过接口DescribeInvocations查询InvokeId。 |
| InstanceId | String | 否 | i-bp1i7gg30r52z2em**** | 实例ID。 |
| CommandId | String | 否 | c-hz0jdfwcsr**** | 命令ID。 |
| InvokeRecordStatus | String | 否 | Running | 命令执行状态。取值范围:
|
| IncludeHistory | Boolean | 否 | false | 是否返回命令周期执行的历史记录。取值范围:
默认值:false |
| ContentEncoding | String | 否 | PlainText | 设置返回数据中
默认值:Base64 |
| PageNumber | Long | 否 | 1 | 当前页码,起始值:1 默认值:1 |
| PageSize | Long | 否 | 1 | 分页查询时设置的每页行数。 最大值:50 默认值:10 |
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Invocation | Struct | 命令执行结果的集合。 |
|
| InvocationResults | Array of InvocationResult | 命令执行结果集。 |
|
| InvocationResult | |||
| CommandId | String | c-hz0jdfwcsr**** | 命令ID。 |
| Dropped | Integer | 0 |
|
| ErrorCode | String | InstanceNotExists | 命令的下发失败或执行失败原因的代码,可能值:
|
| ErrorInfo | String | the specified instance does not exists | 命令的下发失败或执行失败原因的详情,可能值:
|
| ExitCode | Long | 0 | 命令的退出码。
|
| FinishedTime | String | 2019-12-20T06:15:56Z | 命令执行的完成时间。如果命令执行出现超时情况,命令执行的完成时间以CreateCommand中指定的参数TimedOut为准。 |
| InstanceId | String | i-bp1i7gg30r52z2em**** | 实例ID。 |
| InvocationStatus | String | Success | 单台实例的命令进度状态,可能值:
|
| InvokeId | String | t-hz0jdfwd9f**** | 命令执行ID。 |
| InvokeRecordStatus | String | Running | 命令执行状态。 |
| Output | String | MTU6MzA6MDEK | 命令执行后的输出信息。 |
| Repeats | Integer | 0 | 命令在该实例上执行的次数。
|
| StartTime | String | 2019-12-20T06:15:55Z | 命令在实例中开始执行的时间。 |
| StopTime | String | 2020-01-19T09:15:47Z | 若调用了 |
| Username | String | root | 在ECS实例中执行命令的用户名称。 |
| PageNumber | Long | 1 | 当前页码。 |
| PageSize | Long | 1 | 分页查询时设置的每页行数。 |
| TotalCount | Long | 1 | 命令总个数。 |
| RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E | 请求ID。 |
示例
请求示例
https://ecs.aliyuncs.com/?Action=DescribeInvocationResults &RegionId=cn-hangzhou &InstanceId=i-bp1i7gg30r52z2em**** &PageNumber=1 &PageSize=1 &<公共请求参数>
正常返回示例
XML格式
<DescribeInvocationResultsResponse>
<RequestId>F416C43A-6581-4138-9503-4FBBC4EA1BB7</RequestId>
<Invocation>
<InvocationResults>
<InvocationResult>
<Dropped>0</Dropped>
<InvocationStatus>Failed</InvocationStatus>
<InstanceId>i-bp1i7gg30r52z2em****</InstanceId>
<ExitCode>1</ExitCode>
<ErrorInfo>the command execution exit code is not zero.</ErrorInfo>
<StartTime>2020-05-11T09:01:40Z</StartTime>
<Repeats>1</Repeats>
<InvokeRecordStatus>Finished</InvokeRecordStatus>
<FinishedTime>2020-05-11T09:01:41Z</FinishedTime>
<Output></Output>
<CommandId>c-hz0jdfwcsr****</CommandId>
<ErrorCode>ExitCodeNonzero</ErrorCode>
<InvokeId>t-hz0jdfwd9f****</InvokeId>
<StopTime></StopTime>
</InvocationResult>
</InvocationResults>
<TotalCount>5</TotalCount>
<PageSize>1</PageSize>
<PageNumber>1</PageNumber>
</Invocation>
</DescribeInvocationResultsResponse>
JSON格式
{
"RequestId": "F416C43A-6581-4138-9503-4FBBC4EA1BB7",
"Invocation": {
"InvocationResults": {
"InvocationResult": [
{
"Dropped": 0,
"InvocationStatus": "Failed",
"InstanceId": "i-bp1i7gg30r52z2em****",
"ExitCode": 1,
"ErrorInfo": "the command execution exit code is not zero.",
"StartTime": "2020-05-11T09:01:40Z",
"Repeats": 1,
"InvokeRecordStatus": "Finished",
"FinishedTime": "2020-05-11T09:01:41Z",
"Output": "",
"CommandId": "c-hz0jdfwcsr****",
"ErrorCode": "ExitCodeNonzero",
"InvokeId": "t-hz0jdfwd9f****",
"StopTime": ""
}
]
},
"TotalCount": 5,
"PageSize": 1,
"PageNumber": 1
}
}
错误码
| HttpCode | 错误码 | 错误信息 | 描述 |
|---|---|---|---|
| 400 | RegionId.ApiNotSupported | The api is not supported in this region. | 指定地域下不支持调用API。请检查RegionId参数取值是否正确。 |
| 500 | InternalError.Dispatch | An error occurred when you dispatched the request. | 发送请求时发生错误,请稍后重试。 |
| 403 | InvalidParam.PageNumber | The specified parameter is invalid. | 指定的PageNumber参数无效。 |
| 403 | InvalidParam.PageSize | The specified parameter is invalid. | 指定的PageSize参数无效。 |
访问错误中心查看更多错误码。