All Products
Search
Document Center

Elastic Compute Service:DescribeInvocationResults

Last Updated:Mar 19, 2024

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

Operation description

  • After you run a command, the command may fail to run or may return unexpected results. You can call this operation to query the actual execution results.
  • You can query information about command executions within the last four weeks. Up to 100,000 pieces of execution information can be retained.
    • Method 1: During a paged query, when you call the DescribeInvocationResults operation to retrieve the first page of results, set MaxResults to specify the maximum number of entries to return in the call. The return value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results. When you call the DescribeInvocationResults operation to retrieve a new page of results, set NextToken to the NextToken value returned in the previous call and set MaxResults to specify the maximum number of entries to return in this call.
    • Method 2: Use PageSize to specify the number of entries to return on each page and then use PageNumber to specify the number of the page to return. You can use only one of the preceding methods. If you specify MaxResults or NextToken, the PageSize and PageNumber request parameters do not take effect and the TotalCount response parameter is invalid.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
ResourceGroupIdstringNo

The ID of the resource group. After you set this parameter, command execution results in the specified resource group are queried.

rg-bp67acfmxazb4p****
InvokeIdstringNo

The ID of the command task. You can call the DescribeInvocations operation to query the IDs of all command tasks.

t-hz0jdfwd9f****
InstanceIdstringNo

The ID of the instance.

i-bp1i7gg30r52z2em****
CommandIdstringNo

The ID of the command.

c-hz0jdfwcsr****
InvokeRecordStatusstringNo

The execution state of the command task. Valid values:

  • Running
  • Finished
  • Failed
  • Stopped
Note To ensure compatibility, we recommend that you use InvocationStatus instead of InvokeRecordStatus.
Running
IncludeHistorybooleanNo

Specifies whether to return the results of historical scheduled executions. Valid values:

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

Default value: false.

false
ContentEncodingstringNo

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.

PlainText
PageNumberlongNo

The page number.

Pages start from page 1.

Default value: 1.

1
PageSizelongNo

The number of entries per page.

Valid values: 1 to 50.

Default value: 10.

1
MaxResultsintegerNo

The maximum number of entries per page.

Valid values: 1 to 50.

Default value: 10.

10
NextTokenstringNo

The pagination token that is used in the next request to retrieve a new page of results. You must specify the token that is obtained from the previous query as the value of NextToken.

AAAAAdDWBF2
Tagobject []No

The tags of the command task.

KeystringNo

The key of tag N of the command task. Valid values of N: 1 to 20. The tag key cannot be an empty string.

If a single tag is specified to query resources, up to 1,000 resources that have this tag added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags added can be displayed in the response. To query more than 1,000 resources that have specified tags added, call the ListTagResources operation.

The tag key can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

TestKey
ValuestringNo

The value of tag N of the command task. Valid values of N: 1 to 20. The tag value can be an empty string.

The tag value can be up to 128 characters in length and cannot contain http:// or https://.

TestValue

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE*****
Invocationobject

The information about the execution results.

PageSizelong

The number of entries per page.

1
PageNumberlong

The page number.

1
TotalCountlong

The total number of the commands.

1
NextTokenstring

The query token returned in this call.

AAAAAdDWBF2
InvocationResultsobject []

The execution results.

InvocationStatusstring

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 failed 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:

    • Command that is set to run only once: The execution is complete, and the exit code is 0.
    • Command that is set to run on a schedule: The previous execution is complete, and the exit code is 0. The specified execution period ends.
  • Failed:

    • Command that is set to run only once: The execution is complete, but the exit code is not 0.
    • Command that is set to run on a schedule: The previous execution is complete, but the exit code is not 0. The specified execution period is about to end.
  • Error: The execution cannot proceed due to an exception.

  • Timeout: The execution timed out.

  • Cancelled: The execution is canceled, and the command is not run.

  • Stopping: The command task is being stopped.

  • Terminated: The command task is terminated while it is being run.

  • Scheduled:

    • Command that is set to run only once: The execution state cannot be Scheduled.
    • Command that is set to run on a schedule: The command is waiting to be run.
Success
Repeatsinteger

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

  • If the command is set to run only once, the value is 0 or 1.
  • If the command is set to run on a schedule, the value is the number of times that the command was run.
0
CommandIdstring

The ID of the command.

c-hz0jdfwcsr****
InstanceIdstring

The ID of the instance

i-bp1i7gg30r52z2em****
Outputstring

The command output.

MTU6MzA6MDEK
Droppedinteger

The size of the text that is truncated and discarded when the Output value exceeds 24 KB in size.

0
StopTimestring

The time when the command task was stopped. If you call the StopInvocation operation to stop the command task, the value of this parameter is the time when the operation is called.

2020-01-19T09:15:47Z
ExitCodelong

The exit code of the command task.

  • For Linux instances, the exit code is the exit code of the shell command.
  • For Windows instances, the exit code is the exit code of the batch or PowerShell command.
0
StartTimestring

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

2019-12-20T06:15:55Z
ErrorInfostring

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

  • If this parameter is left 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 is upgrading now
  • 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
the specified instance does not exists
ErrorCodestring

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

  • If this parameter is left empty, the command is run normally.
  • InstanceNotExists: The instance does not exist or is 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: Cloud Assistant Agent is not running.
  • ClientNotResponse: Cloud Assistant Agent does not respond.
  • ClientIsUpgrading: Cloud Assistant Agent was being upgraded.
  • ClientNeedUpgrade: Cloud Assistant Agent must be upgraded.
  • DeliveryTimeout: The request to send the command timed out.
  • ExecutionTimeout: The request to send the command timed out.
  • ExecutionException: An exception occurred while the command is being run.
  • ExecutionInterrupted: The execution is interrupted.
  • ExitCodeNonzero: The execution is complete, but the exit code is not 0.
InstanceNotExists
FinishedTimestring

The time when the command task was complete. If the command task times out, the end time is equal to the start time of the command task specified by StartTime plus the timeout period specified by Timeout in the CreateCommand operation.

2019-12-20T06:15:56Z
InvokeIdstring

The ID of the command task.

t-hz0jdfwd9f****
InvokeRecordStatusstring

The execution state of the command task.

Running
Usernamestring

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

root
ContainerIdstring

The container ID.

ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****
ContainerNamestring

The container name.

test-container
Tagsobject []

The tags of the command task.

TagKeystring

The tag key of the command task.

owner
TagValuestring

The tag value of the command task.

zhangsan

Examples

Sample success responses

JSONformat

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE*****",
  "Invocation": {
    "PageSize": 1,
    "PageNumber": 1,
    "TotalCount": 1,
    "NextToken": "AAAAAdDWBF2",
    "InvocationResults": {
      "InvocationResult": [
        {
          "InvocationStatus": "Success",
          "Repeats": 0,
          "CommandId": "c-hz0jdfwcsr****",
          "InstanceId": "i-bp1i7gg30r52z2em****",
          "Output": "MTU6MzA6MDEK",
          "Dropped": 0,
          "StopTime": "2020-01-19T09:15:47Z",
          "ExitCode": 0,
          "StartTime": "2019-12-20T06:15:55Z",
          "ErrorInfo": "the specified instance does not exists",
          "ErrorCode": "InstanceNotExists",
          "FinishedTime": "2019-12-20T06:15:56Z",
          "InvokeId": "t-hz0jdfwd9f****",
          "InvokeRecordStatus": "Running",
          "Username": "root",
          "ContainerId": "ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****",
          "ContainerName": "test-container",
          "Tags": {
            "Tag": [
              {
                "TagKey": "owner",
                "TagValue": "zhangsan"
              }
            ]
          }
        }
      ]
    }
  }
}

Error codes

HTTP status codeError codeError messageDescription
400RegionId.ApiNotSupportedThe api is not supported in this region.The API operation cannot be called in the specified region. Check whether the specified RegionId parameter is valid.
400NumberExceed.TagsThe Tags parameter number is exceed.The number of tags exceeds the maximum limit.
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.The specified tag key already exists. Tag keys must be unique.
400InvalidTagKey.MalformedThe specified Tag.n.Key is not valid.The specified Tag.N.Key parameter is invalid.
400InvalidTagValue.MalformedThe specified Tag.n.Value is not valid.The specified tag value is invalid.
400MissingParameter.TagKeyYou must specify Tag.N.Key.The tag key is not specified.
400InvalidParam.PageNumberThe specified parameter is invalid.The specified PageNumber parameter is invalid.
400InvalidParam.PageSizeThe specified parameter is invalid.The specified PageSize parameter is invalid.
400InvalidParameter.NextTokenThe specified parameter NextToken is not valid.The specified parameter NextToken is illegal.
400InvalidParameter.MaxResultsThe specified parameter MaxResults is not valid.The specified parameter MaxResults is illegal.
403Operation.ForbiddenThe operation is not permitted.The operation is not supported.
404InvalidRegionId.NotFoundThe RegionId provided does not exist in our records.The RegionId provided does not exist
500InternalError.DispatchAn error occurred when you dispatched the request.An error occurred while the request is being sent. Try again later.
500ServiceUnavailableThe request has failed due to a temporary failure of the server.-
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-21The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: MaxResults
    Added Input Parameters: NextToken
Output ParametersThe response structure of the API has changed.
2023-05-12The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
    delete Error Codes: 404
    delete Error Codes: 500
2022-02-25The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 403 change
    Error Codes 404 change
    delete Error Codes: 400
    delete Error Codes: 500