Queries the execution results of one or more Cloud Assistant commands on Elastic Compute Service (ECS) instances.

Description

  • After you run a command, the command may not succeed or return the expected results. You can call this operation to query the actual execution results.
  • You can query execution information that was generated within the last two weeks. A maximum of 100,000 pieces of execution information can be retained.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeInvocationResults

The operation that you want to perform. Set the value to DescribeInvocationResults.

RegionId String Yes cn-hangzhou

The region ID of the command. You can call the DescribeRegions operation to query the most recent region list.

InvokeId String No t-hz0jdfwd9f****

The ID of the execution. You can call the DescribeInvocations operation to query the execution IDs.

InstanceId String No i-bp1i7gg30r52z2em****

The ID of the instance.

CommandId String No c-hz0jdfwcsr****

The ID of the command.

InvokeRecordStatus String No Running

The state of the execution. Valid values:

  • Running
  • Finished
  • Failed
  • Stopped
Note To improve compatibility, we recommend that you do not use this parameter. We recommend that you use the InvocationStatus parameter.
IncludeHistory Boolean No false

Specifies whether to return the historical results of the recurring execution. Valid values:

  • true: returns the historical results of the recurring execution. When this parameter is set to true, the InvokeId parameter must be set to the ID of a recurring execution.
  • false: does not return the historical results of the recurring execution.

Default value: false.

ContentEncoding String No PlainText

The encoding method of the Output response parameter. Valid values:

  • PlainText: returns the original command content and command output.
  • Base64: returns the Base64-encoded command content and command output.

Default value: Base64.

PageNumber Long No 1

The number of the page to return.

Pages start from page 1.

Default value: 1.

PageSize Long No 1

The number of entries to return on each page.

Maximum value: 50.

Default value: 10.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Invocation Object

Details of the execution result.

PageSize Long 1

The number of entries returned per page.

PageNumber Long 1

The page number of the returned page.

TotalCount Long 1

The total number of commands.

InvocationResults Array of InvocationResult

The execution results.

InvocationResult
InvocationStatus String Success

The execution state on a single instance. Valid values:

  • Pending: The command is being verified or sent.
  • Invalid: The specified command type or parameter is invalid.
  • Aborted: The command fails to be sent. To send a command to an instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute.
  • Running: The command is being run on the instance.
  • Success:
    • One-time execution: The execution is complete, and the exit code is 0.
    • Recurring execution: The last execution succeeds, the exit code is 0, and the specified cycle ends.
  • Failed:
    • One-time execution: The execution is complete, but the exit code is not 0.
    • Recurring execution: The last execution is complete, the exit code is not 0, and the specified cycle is about to end.
  • Error: The execution cannot proceed due to an exception.
  • Timeout: The execution times out.
  • Cancelled: The execution is canceled, and the command is not started.
  • Stopping: The command that is running is being stopped.
  • Terminated: The command is terminated while it is being run.
  • Scheduled:
    • One-time execution: The command is not applicable.
    • Recurring execution: The command is waiting to be run.
Repeats Integer 0

The number of times that the command is run on the instance.

  • If the execution is a one-time execution, the value is 0 or 1.
  • If the execution is a recurring execution, the value is the number of times that the command is run.
CommandId String c-hz0jdfwcsr****

The ID of the command.

InstanceId String i-bp1i7gg30r52z2em****

The ID of the instance.

Output String MTU6MzA6MDEK

The command output.

Dropped Integer 0

The size of truncated and discarded text when the size of text in the Output response parameter is larger than 24 KB.

StopTime String 2020-01-19T09:15:47Z

The time when the command stopped being run on the instance. If you call the StopInvocation operation to manually stop the execution, the value is the time when you call the operation.

ExitCode Long 0

The exit code of the command.

  • For Linux instances, the value is the exit code of the shell command.
  • For Windows instances, the value is the exit code of the batch or PowerShell command.
StartTime String 2019-12-20T06:15:55Z

The time when the command started to be run on the instance.

ErrorInfo String the specified instance does not exists

The error message returned when the command cannot be sent or run. Valid values:

  • If this parameter is empty, the command is run normally.
  • the specified instance does not exists
  • the instance has released when create task
  • the instance is not running when create task
  • the command is not applicable
  • the specified account does not exists
  • the specified directory does not exists
  • the cron job expression is invalid
  • the aliyun service is not running on the instance
  • the aliyun service in the instance does not response
  • the aliyun service in the instance is upgrading now
  • the aliyun service in the instance need upgrade
  • the command delivery has been timeout
  • the command execution has been timeout
  • the command execution got an exception
  • the command execution has been interrupted
  • the command execution exit code is not zero
ErrorCode String InstanceNotExists

The error code returned when the command cannot be sent or run. Valid values:

  • If this parameter is empty, the command is run normally.
  • InstanceNotExists: The instance does not exist or has been released.
  • InstanceReleased: The instance is released while the command is being run.
  • InstanceNotRunning: The instance is not running while the command is being run.
  • CommandNotApplicable: The command is not applicable to the specified instance.
  • AccountNotExists: The specified account does not exist.
  • DirectoryNotExists: The specified directory does not exist.
  • BadCronExpression: The specified cron expression for the execution schedule is invalid.
  • ClientNotRunning: The Cloud Assistant client is not running.
  • ClientNotResponse: The Cloud Assistant client does not respond.
  • ClientIsUpgrading: The Cloud Assistant client is being upgraded.
  • ClientNeedUpgrade: The Cloud Assistant client needs to be upgraded.
  • DeliveryTimeout: The request to send the command has timed out.
  • ExecutionTimeout: The execution has timed out.
  • ExecutionException: An exception has occurred while the command is being run.
  • ExecutionInterrupted: The execution is interrupted.
  • ExitCodeNonzero: The execution is complete, but the exit code is not 0.
FinishedTime String 2019-12-20T06:15:56Z

The completion time of the execution. If an execution times out, the completion time of the execution is subject to the value of the TimedOut parameter specified in the CreateCommand operation.

InvokeId String t-hz0jdfwd9f****

The ID of the execution.

InvokeRecordStatus String Running

The status of the execution.

Username String root

The username that was used to run the command on the ECS instance.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeInvocationResults
&RegionId=cn-hangzhou
&InstanceId=i-bp1i7gg30r52z2em****
&PageNumber=1
&PageSize=1
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/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/>
                <CommandId>c-hz0jdfwcsr****</CommandId>
                <ErrorCode>ExitCodeNonzero</ErrorCode>
                <InvokeId>t-hz0jdfwd9f****</InvokeId>
                <StopTime/>
            </InvocationResult>
        </InvocationResults>
        <TotalCount>5</TotalCount>
        <PageSize>1</PageSize>
        <PageNumber>1</PageNumber>
    </Invocation>
</DescribeInvocationResultsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/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
  }
}

Error codes

HTTP state code Error code Error message Description
400 RegionId.ApiNotSupported The api is not supported in this region. The error message returned because the operation cannot be called in the specified region. Check whether the RegionId parameter is valid.
403 InvalidParam.PageNumber The specified parameter is invalid. The error message returned because the specified PageNumber parameter is invalid.
403 InvalidParam.PageSize The specified parameter is invalid. The error message returned because the specified PageSize parameter is invalid.
403 Operation.Forbidden The operation is not permitted. The error message returned because the operation is not supported.
500 InternalError.Dispatch An error occurred when you dispatched the request. The error message returned because an error occurred when the request was being sent. Try again later.

For a list of error codes, visit the API Error Center.