调用DescribeInvocations查询云助手脚本的执行列表和状态。
接口说明
- 当您执行命令后,不代表命令一定成功运行,并且一定有预期的命令效果。您需要通过接口返回值查看实际执行结果,以实际输出结果为准。
- 您可以查询最近2周的执行信息,执行信息的保留上限为10万条。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | DescribeInvocations |
系统规定参数。取值:DescribeInvocations |
RegionId | String | 是 | cn-hangzhou |
地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。 |
InvokeId | String | 否 | t-hz0jdfwd9f**** |
脚本进程执行ID。 |
CommandId | String | 否 | c-hz0jdfwcsr**** |
脚本ID。您可以通过接口DescribeCommands查询所有可用的CommandId。 |
CommandName | String | 否 | CommandTestName |
脚本名称。 |
CommandType | String | 否 | RunShellScript |
脚本类型。 |
Timed | Boolean | 否 | true |
脚本是否为周期执行。 默认值:false |
InvokeStatus | String | 否 | Finished |
脚本执行的总执行状态。总执行状态取决于创建执行中的一台或多台实例的共同执行状态(
默认值:Running |
InstanceId | String | 否 | i-bp1i7gg30r52z2em**** |
实例ID。当您传入了该参数,将查询该实例所有的脚本执行记录。 |
ContentEncoding | String | 否 | PlainText |
设置返回数据中
默认值:Base64 |
IncludeOutput | Boolean | 否 | false |
是否在结果中返回脚本运行的输出信息。
默认值:false |
PageNumber | Long | 否 | 1 |
当前页码。 起始值:1 默认值:1 |
PageSize | Long | 否 | 10 |
分页查询时设置的每页行数。 最大值:50 默认值:10 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Invocations | Array of Invocation |
脚本执行记录集类型。 |
|
Invocation | |||
CommandContent | String | cnBtIC1xYSB8IGdyZXAgdnNm**** |
脚本内容,以Base64编码后传输。 |
CommandId | String | c-hz0jdfwcsr**** |
脚本ID。 |
CommandName | String | CommandTestName |
脚本名称。 |
CommandType | String | RunShellScript |
脚本类型。 |
CreationTime | String | 2020-01-19T09:15:46Z |
任务的创建时间。 |
Frequency | String | 0 */20 * * * * |
周期任务的执行周期。该参数值结构以Cron表达式为准。 |
InvocationStatus | String | Pending |
脚本执行的总执行状态,总执行状态取决于本次调用的全部实例的共同执行状态,可能值:
|
InvokeId | String | t-hz0jdfwd9f**** |
执行ID。 |
InvokeInstances | Array of InvokeInstance |
执行目标实例集类型。 |
|
InvokeInstance | |||
CreationTime | String | 2019-12-20T06:15:54Z |
脚本进程的创建时间。 |
Dropped | Integer | 0 |
Output字段中文字长度超出24KB后,截断丢弃的文字长度。 |
ErrorCode | String | InstanceNotExists |
命令的下发失败或执行失败原因的代码,可能值:
|
ErrorInfo | String | the specified instance does not exists |
命令的下发失败或执行失败原因的详情,可能值:
|
ExitCode | Long | 0 |
脚本进程的退出代码。可能值:
|
FinishTime | String | 2019-12-20T06:15:56Z |
脚本进程的结束时间。 |
InstanceId | String | i-bp1i7gg30r52z2em**** |
实例ID。 |
InstanceInvokeStatus | String | Finished |
单台实例的脚本进程状态。可能值:
|
InvocationStatus | String | Success |
单台实例的脚本进度状态,可能值:
|
Output | String | OutPutTestmsg |
脚本进程的输出信息。 |
Repeats | Integer | 0 |
命令在该实例上执行的次数。
|
StartTime | String | 2019-12-20T06:15:55Z |
脚本进程在实例中开始执行的时间。 |
StopTime | String | 2020-01-19T09:15:47Z |
若调用了 |
UpdateTime | String | 2020-01-19T09:15:47Z |
任务状态的更新时间。 |
InvokeStatus | String | Finished |
脚本总的执行状态。 说明 不推荐查看该返回值,推荐您查看
InvocationStatus 的返回值。
|
Parameters | String | {} |
脚本中的自定义参数。 |
Timed | Boolean | false |
是否为周期执行。 |
Username | String | root |
ECS实例中执行脚本的用户名称。 |
PageNumber | Long | 1 |
查询结果的页码。 |
PageSize | Long | 10 |
每页行数。 |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
请求ID。 |
TotalCount | Long | 2 |
脚本总个数。 |
示例
请求示例
https://ecs.aliyuncs.com/?Action=DescribeInvocations
&RegionId=cn-hangzhou
&InvokeId=t-hz0jdfwd9f****
&CommandId=c-hz0jdfwcsr****
&CommandName=CommandTestName
&CommandType=RunShellScrip
&Timed=true
&InvokeStatus=Finished
&InstanceId=i-bp1i7gg30r52z2em****
&PageNumber=1
&PageSize=10
&<公共请求参数>
正常返回示例
XML
格式
<DescribeInvocationsResponse>
<TotalCount>5</TotalCount>
<RequestId>634562E9-F291-4289-B60B-FC511A43CD34</RequestId>
<PageSize>1</PageSize>
<PageNumber>1</PageNumber>
<Invocations>
<Invocation>
<CommandContent>cnBtIC1xYSB8IGdyZXAgdnNm****</CommandContent>
<InvocationStatus>Failed</InvocationStatus>
<InvokeStatus>Finished</InvokeStatus>
<Parameters>{}</Parameters>
<CommandType>RunShellScript</CommandType>
<Timed>false</Timed>
<CreationTime>2020-05-11T09:01:39Z</CreationTime>
<Frequency></Frequency>
<CommandId>c-hz0jdfwcsr****</CommandId>
<CommandName>AutoTest</CommandName>
<InvokeId>t-hz0jdfwd9f****</InvokeId>
<InvokeInstances>
<InvokeInstance>
<Dropped>0</Dropped>
<InvocationStatus>Failed</InvocationStatus>
<InstanceId>i-bp1i7gg30r52z2em****</InstanceId>
<InstanceInvokeStatus>Finished</InstanceInvokeStatus>
<ExitCode>1</ExitCode>
<ErrorInfo>the command execution exit code is not zero.</ErrorInfo>
<StartTime>2020-05-11T09:01:40Z</StartTime>
<Repeats>1</Repeats>
<FinishTime>2020-05-11T09:01:41Z</FinishTime>
<Output></Output>
<CreationTime>2020-05-11T09:01:39Z</CreationTime>
<UpdateTime>2020-05-11T09:01:41Z</UpdateTime>
<ErrorCode>ExitCodeNonzero</ErrorCode>
<StopTime></StopTime>
</InvokeInstance>
</InvokeInstances>
</Invocation>
</Invocations>
</DescribeInvocationsResponse>
JSON
格式
{
"TotalCount": 5,
"RequestId": "634562E9-F291-4289-B60B-FC511A43CD34",
"PageSize": 1,
"PageNumber": 1,
"Invocations": {
"Invocation": [
{
"CommandContent": "cnBtIC1xYSB8IGdyZXAgdnNm****",
"InvocationStatus": "Failed",
"InvokeStatus": "Finished",
"Parameters": "{}",
"CommandType": "RunShellScript",
"Timed": false,
"CreationTime": "2020-05-11T09:01:39Z",
"Frequency": "",
"CommandId": "c-hz0jdfwcsr****",
"CommandName": "AutoTest",
"InvokeId": "t-hz0jdfwd9f****",
"InvokeInstances": {
"InvokeInstance": [
{
"Dropped": 0,
"InvocationStatus": "Failed",
"InstanceId": "i-bp1i7gg30r52z2em****",
"InstanceInvokeStatus": "Finished",
"ExitCode": 1,
"ErrorInfo": "the command execution exit code is not zero.",
"StartTime": "2020-05-11T09:01:40Z",
"Repeats": 1,
"FinishTime": "2020-05-11T09:01:41Z",
"Output": "",
"CreationTime": "2020-05-11T09:01:39Z",
"UpdateTime": "2020-05-11T09:01:41Z",
"ErrorCode": "ExitCodeNonzero",
"StopTime": ""
}
]
}
}
]
}
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
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参数无效。 |
访问错误中心查看更多错误码。
在文档使用中是否遇到以下问题
更多建议
匿名提交