Queries the list of tasks and execution status of Cloud Assistant commands.
Usage notes
- After you run a command, the command may not succeed or return the expected results. You can call this operation to query the execution results.
- You can query the information about command tasks within the last four weeks. Up to 100,000 pieces of task information can be retained.
Debugging
Request parameters
Parameter |
Type |
Required |
Example |
Description |
Action | String | Yes | DescribeInvocations | The operation that you want to perform. Set the value to DescribeInvocations. |
RegionId | String | Yes | cn-hangzhou | The region ID of the command. You can call the DescribeRegions operation to query the most recent region list. |
ResourceGroupId | String | No | rg-bp67acfmxazb4p**** | The ID of the resource group. After you set this parameter, command execution results in the specified resource group are queried. |
InvokeId | String | No | t-hz0jdfwd9f**** | The ID of the command task. |
CommandId | String | No | c-hz0jdfwcsr**** | The ID of the command. You can call the DescribeCommands operation to query all available command IDs. |
CommandName | String | No | CommandTestName | The name of the command. If this parameter and |
CommandType | String | No | RunShellScript | The type of the command. Valid values:
|
Timed | Boolean | No | true | Specifies whether the command is to be automatically run. Valid values:
Default value: false. |
InvokeStatus | String | No | Finished | The overall execution status of the command task. The value of this parameter depends on the execution states on all involved instances. Valid values:
|
InstanceId | String | No | i-bp1i7gg30r52z2em**** | The ID of the instance. When you specify this parameter, the system queries all execution records of all commands that run on the instance. |
ContentEncoding | String | No | PlainText | The encoding mode of the
Default value: Base64. |
IncludeOutput | Boolean | No | false | Specifies whether to return the command outputs in the response.
Default value: false. |
PageNumber | Long | No | 1 | The page number. Pages start from page 1. Default value: 1. |
PageSize | Long | No | 10 | The number of entries per page. Valid values: 1 to 50. Default value: 10. |
RepeatMode | String | No | Once | The execution mode of the command. If this parameter and
This parameter is empty by default, which indicates that commands run in all modes are queried. |
Tag.N.Key | String | No | TestKey | 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 you specify a single tag to query resources, up to 1,000 resources to which the tag is added are returned. If you specify multiple tags to query resources, up to 1,000 resources to which all specified tags are added are returned. To query more than 1,000 resources to which the specified tags are added, call the ListTagResources operation. The tag key can be up to 64 characters in length and cannot contain |
Tag.N.Value | String | No | TestValue | 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 |
Response parameters
Parameter |
Type |
Example |
Description |
PageSize | Long | 10 | The number of entries per page. |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** | The ID of the request. |
PageNumber | Long | 1 | The page number. |
TotalCount | Long | 1 | The total number of commands. |
Invocations | Array of Invocation | The queried command tasks. |
|
Invocation | |||
CreationTime | String | 2020-01-19T09:15:46Z | The time when the command task was created. |
Frequency | String | 0 */20 * * * * | The schedule on which the command is run. |
InvocationStatus | String | Running | The overall execution status of the command task. The value of this parameter depends on the execution states on all the involved instances. Valid values:
Note InvokeStatus in the response functions similarly to this parameter. We recommend that you check the value of this parameter. |
RepeatMode | String | Once | The execution mode of the command. Valid values:
|
CommandId | String | c-hz0jdfwcsr**** | The ID of the command. |
CommandType | String | RunShellScript | The type of the command. |
InvokeStatus | String | Finished | The overall execution status of the command task. Note We recommend that you ignore this parameter and check the value of InvocationStatus in the response for the overall execution state. |
Parameters | String | {} | The custom parameters in the command. |
Timed | Boolean | false | Indicates whether the command is to be automatically run. |
CommandContent | String | cnBtIC1xYSB8IGdyZXAgdnNm**** | The content of the command.
|
CommandName | String | CommandTestName | The name of the command. |
CommandDescription | String | testDescription | The description of the command. |
InvokeId | String | t-hz0jdfwd9f**** | The ID of the command task. |
Username | String | test | The username that was used to run the command on the instance. |
WorkingDir | String | /home/ | The execution path of the command. |
Timeout | Long | 60 | The maximum timeout period for command executions on the instance. Unit: seconds. When a command cannot be run, a timeout error occurs. When a command execution times out, Cloud Assistant Agent forcefully terminates the command process by canceling the process ID (PID). |
ContainerId | String | ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea**** | The ID of the container. |
ContainerName | String | test-container | The name of the container. |
InvokeInstances | Array of InvokeInstance | The instances on which the command was run. |
|
InvokeInstance | |||
CreationTime | String | 2019-12-20T06:15:54Z | The time when the command started to run on the instance. |
UpdateTime | String | 2020-01-19T09:15:47Z | The time when the execution status was updated. |
FinishTime | String | 2019-12-20T06:15:56Z | The time when the command process ended. |
InvocationStatus | String | Success | The execution state on a single instance. Valid values:
|
Repeats | Integer | 0 | The number of times that the command was run on the instance.
|
InstanceId | String | i-bp1i7gg30r52z2em**** | The ID of the instance. |
Output | String | OutPutTestmsg | The command output.
|
Dropped | Integer | 0 | The size of the Output text that is truncated and discarded when the Output value exceeds 24 KB in size. |
StopTime | String | 2020-01-19T09:15:47Z | The time when the command task was stopped. If you call the |
ExitCode | Long | 0 | The exit code of the execution. Valid values:
|
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 reason why the command failed to be sent or run. Valid values:
|
Timed | Boolean | false | Indicates whether the command is to be automatically run. |
ErrorCode | String | InstanceNotExists | The code that indicates why the command failed to be sent or run. Valid values:
|
InstanceInvokeStatus | String | Finished | The execution state on a single instance. Note We recommend that you ignore this parameter and check the value of InvocationStatus in the response for the overall execution state. |
Tags | Array of Tag | The tags of the command task. |
|
Tag | |||
TagKey | String | owner | The tag key of the command task. |
TagValue | String | zhangsan | The tag value of the command task. |
Examples
Sample requests
http(s)://ecs.aliyuncs.com/?Action=DescribeInvocations
&RegionId=cn-hangzhou
&InvokeId=t-hz0jdfwd9f****
&CommandId=c-hz0jdfwcsr****
&CommandName=CommandTestName
&CommandType=RunShellScript
&Timed=true
&InvokeStatus=Finished
&InstanceId=i-bp1i7gg30r52z2em****
&PageNumber=1
&PageSize=10
&RepeatMode=Once
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeInvocationsResponse>
<PageSize>10</PageSize>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
<PageNumber>1</PageNumber>
<TotalCount>1</TotalCount>
<Invocations>
<Invocation>
<CreationTime>2020-01-19T09:15:46Z</CreationTime>
<Frequency>0 */20 * * * *</Frequency>
<InvocationStatus>Running</InvocationStatus>
<RepeatMode>Once</RepeatMode>
<CommandId>c-hz0jdfwcsr****</CommandId>
<CommandType>RunShellScript</CommandType>
<InvokeStatus>Finished</InvokeStatus>
<Parameters>{}</Parameters>
<Timed>false</Timed>
<CommandContent>cnBtIC1xYSB8IGdyZXAgdnNm****</CommandContent>
<CommandName>CommandTestName</CommandName>
<CommandDescription>testDescription</CommandDescription>
<InvokeId>t-hz0jdfwd9f****</InvokeId>
<Username>test</Username>
<WorkingDir>/home/</WorkingDir>
<Timeout>60</Timeout>
<ContainerId>ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****</ContainerId>
<ContainerName>test-container</ContainerName>
<InvokeInstances>
<InvokeInstance>
<CreationTime>2019-12-20T06:15:54Z</CreationTime>
<UpdateTime>2020-01-19T09:15:47Z</UpdateTime>
<FinishTime>2019-12-20T06:15:56Z</FinishTime>
<InvocationStatus>Success</InvocationStatus>
<Repeats>0</Repeats>
<InstanceId>i-bp1i7gg30r52z2em****</InstanceId>
<Output>OutPutTestmsg</Output>
<Dropped>0</Dropped>
<StopTime>2020-01-19T09:15:47Z</StopTime>
<ExitCode>0</ExitCode>
<StartTime>2019-12-20T06:15:55Z</StartTime>
<ErrorInfo>the specified instance does not exists</ErrorInfo>
<Timed>false</Timed>
<ErrorCode>InstanceNotExists</ErrorCode>
<InstanceInvokeStatus>Finished</InstanceInvokeStatus>
</InvokeInstance>
<Tags>
<TagKey>owner</TagKey>
<TagValue>zhangsan</TagValue>
</Tags>
</InvokeInstances>
</Invocation>
</Invocations>
</DescribeInvocationsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"PageSize" : 10,
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"PageNumber" : 1,
"TotalCount" : 1,
"Invocations" : {
"Invocation" : [ {
"CreationTime" : "2020-01-19T09:15:46Z",
"Frequency" : "0 */20 * * * *",
"InvocationStatus" : "Running",
"RepeatMode" : "Once",
"CommandId" : "c-hz0jdfwcsr****",
"CommandType" : "RunShellScript",
"InvokeStatus" : "Finished",
"Parameters" : "{}",
"Timed" : false,
"CommandContent" : "cnBtIC1xYSB8IGdyZXAgdnNm****",
"CommandName" : "CommandTestName",
"CommandDescription" : "testDescription",
"InvokeId" : "t-hz0jdfwd9f****",
"Username" : "test",
"WorkingDir" : "/home/",
"Timeout" : 60,
"ContainerId" : "ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****",
"ContainerName" : "test-container",
"InvokeInstances" : {
"InvokeInstance" : [ {
"CreationTime" : "2019-12-20T06:15:54Z",
"UpdateTime" : "2020-01-19T09:15:47Z",
"FinishTime" : "2019-12-20T06:15:56Z",
"InvocationStatus" : "Success",
"Repeats" : 0,
"InstanceId" : "i-bp1i7gg30r52z2em****",
"Output" : "OutPutTestmsg",
"Dropped" : 0,
"StopTime" : "2020-01-19T09:15:47Z",
"ExitCode" : 0,
"StartTime" : "2019-12-20T06:15:55Z",
"ErrorInfo" : "the specified instance does not exists",
"Timed" : false,
"ErrorCode" : "InstanceNotExists",
"InstanceInvokeStatus" : "Finished"
} ],
"Tags" : [ {
"TagKey" : "owner",
"TagValue" : "zhangsan"
} ]
}
} ]
}
}
Error codes
HTTP status code |
Error code |
Error message |
Description |
400 | RegionId.ApiNotSupported | The api is not supported in this region. | This operation cannot be performed in the specified region. Check whether the value of the RegionId parameter is valid. |
400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | The tag key already exists. Tag keys must be unique. |
400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | Invalid Tag.N.Key value. |
400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | Invalid Tag.N.Value value. |
400 | MissingParameter.TagKey | You must specify Tag.N.Key. | Tag.N.Key is required. |
400 | InvalidParam.PageNumber | The specified parameter is invalid. | Invalid PageNumber value. |
400 | InvalidParam.PageSize | The specified parameter is invalid. | Invalid PageSize value. |
403 | Operation.Forbidden | The operation is not permitted. | The operation is not supported. |
500 | InternalError.Dispatch | An error occurred when you dispatched the request. | An error occurred when the request was being sent. Try again later. |
For a list of error codes, see Service error codes.