调用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 | 
| RepeatMode | String | 否 | Once | 命令执行的方式。取值范围: 
 默认值:空,表示查询全部。 | 
返回数据
| 名称 | 类型 | 示例值 | 描述 | 
|---|---|---|---|
| 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 | Running | 命令执行的总执行状态,总执行状态取决于本次调用的全部实例的共同执行状态,可能值: 
 | 
| 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的返回值。 | 
| InvocationStatus | String | Success | 单台实例的命令进度状态,可能值: 
 | 
| Output | String | OutPutTestmsg | 命令的输出信息。 | 
| Repeats | Integer | 0 | 命令在该实例上执行的次数。 
 | 
| StartTime | String | 2019-12-20T06:15:55Z | 命令在实例中开始执行的时间。 | 
| StopTime | String | 2020-01-19T09:15:47Z | 若调用了 | 
| Timed | Boolean | false | 查询的命令是否在将来会自动执行。 | 
| UpdateTime | String | 2020-01-19T09:15:47Z | 命令状态的更新时间。 | 
| InvokeStatus | String | Finished | 命令总的执行状态。  
           说明 不推荐查看该返回值,推荐您查看 
            InvocationStatus的返回值。 | 
| Parameters | String | {} | 命令中的自定义参数。 | 
| RepeatMode | String | Once | 命令执行的方式。可能值: 
 | 
| Timed | Boolean | false | 查询的命令是否在将来会自动执行。 | 
| Username | String | root | ECS实例中执行命令的用户名称。 | 
| PageNumber | Long | 1 | 查询结果的页码。 | 
| PageSize | Long | 10 | 每页行数。 | 
| RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E | 请求ID。 | 
| TotalCount | Long | 1 | 命令总个数。 | 
示例
请求示例
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>1</TotalCount>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
      <PageSize>10</PageSize>
      <PageNumber>1</PageNumber>
      <Invocations>
            <Invocation>
                  <InvocationStatus>Running</InvocationStatus>
                  <Parameters>{}</Parameters>
                  <Timed>false</Timed>
                  <InvokeInstances>
                        <InvokeInstance>
                              <Dropped>0</Dropped>
                              <InvocationStatus>Success</InvocationStatus>
                              <InstanceId>i-bp1i7gg30r52z2em****</InstanceId>
                              <Timed>false</Timed>
                              <InstanceInvokeStatus>Finished</InstanceInvokeStatus>
                              <ExitCode>0</ExitCode>
                              <ErrorInfo></ErrorInfo>
                              <StartTime>2019-12-20T06:15:55Z</StartTime>
                              <Repeats>0</Repeats>
                              <FinishTime>2019-12-20T06:15:56Z</FinishTime>
                              <Output>OutPutTestmsg</Output>
                              <CreationTime>2019-12-20T06:15:54Z</CreationTime>
                              <UpdateTime>2020-01-19T09:15:47Z</UpdateTime>
                              <ErrorCode></ErrorCode>
                              <StopTime>2020-01-19T09:15:47Z</StopTime>
                        </InvokeInstance>
                  </InvokeInstances>
                  <CommandContent>cnBtIC1xYSB8IGdyZXAgdnNm****</CommandContent>
                  <RepeatMode>Once</RepeatMode>
                  <InvokeStatus>Finished</InvokeStatus>
                  <CommandType>RunShellScript</CommandType>
                  <Username>root</Username>
                  <CreationTime>2020-01-19T09:15:46Z</CreationTime>
                  <Frequency></Frequency>
                  <CommandId>c-hz0jdfwcsr****</CommandId>
                  <CommandName>CommandTestName</CommandName>
                  <InvokeId>t-hz0jdfwd9f****</InvokeId>
            </Invocation>
      </Invocations>
</DescribeInvocationsResponse> 
     JSON格式 
{
  "TotalCount": 1,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "PageSize": 10,
  "PageNumber": 1,
  "Invocations": {
    "Invocation": [
      {
        "InvocationStatus": "Running",
        "Parameters": "{}",
        "Timed": false,
        "InvokeInstances": {
          "InvokeInstance": [
            {
              "Dropped": 0,
              "InvocationStatus": "Success",
              "InstanceId": "i-bp1i7gg30r52z2em****",
              "Timed": false,
              "InstanceInvokeStatus": "Finished",
              "ExitCode": 0,
              "ErrorInfo": "",
              "StartTime": "2019-12-20T06:15:55Z",
              "Repeats": 0,
              "FinishTime": "2019-12-20T06:15:56Z",
              "Output": "OutPutTestmsg",
              "CreationTime": "2019-12-20T06:15:54Z",
              "UpdateTime": "2020-01-19T09:15:47Z",
              "ErrorCode": "",
              "StopTime": "2020-01-19T09:15:47Z"
            }
          ]
        },
        "CommandContent": "cnBtIC1xYSB8IGdyZXAgdnNm****",
        "RepeatMode": "Once",
        "InvokeStatus": "Finished",
        "CommandType": "RunShellScript",
        "Username": "root",
        "CreationTime": "2020-01-19T09:15:46Z",
        "Frequency": "",
        "CommandId": "c-hz0jdfwcsr****",
        "CommandName": "CommandTestName",
        "InvokeId": "t-hz0jdfwd9f****"
      }
    ]
  }
} 
    错误码
| HttpCode | 错误码 | 错误信息 | 描述 | 
|---|---|---|---|
| 400 | RegionId.ApiNotSupported | The api is not supported in this region. | 指定地域下不支持调用API。请检查RegionId参数取值是否正确。 | 
| 403 | InvalidParam.PageNumber | The specified parameter is invalid. | 指定的PageNumber参数无效。 | 
| 403 | InvalidParam.PageSize | The specified parameter is invalid. | 指定的PageSize参数无效。 | 
| 500 | InternalError.Dispatch | An error occurred when you dispatched the request. | 发送请求时发生错误,请稍后重试。 | 
访问错误中心查看更多错误码。
