You can run a Cloud Assistant command only when all requirements are met, regardless of whether you use the Elastic Compute Service (ECS) console or log on to an instance to run the command. To ensure that your intended operation is complete, we recommend that you check the command execution results and state. If executions fail, you can troubleshoot the issues based on common error messages.

Background information

When exceptions occur, different execution results and states are displayed for the command. These exceptions include a lack of dependencies, network exceptions, command semantic errors, command debugging errors, and abnormal instance status. You can use the ECS console or call an API operation to view the error messages in the execution results and troubleshoot the issues.

View execution results in the ECS console

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Maintenance & Monitoring > ECS Cloud Assistant.
  3. In the top navigation bar, select a region.
  4. Click the Command Execution Result tab to view execution results.
    • If a command execution succeeds, you can view the command output in the execution results.
      1. Find a command task for which Successful is displayed in the Status column.
      2. In the Actions column, click View.
      3. In the Execution Details panel, click the Task Completed tab on the Instances tab to view execution results. View execution results
    • If a command execution fails, find the error message in the execution results and troubleshoot the issue based on the error message.
      1. Find a command task for which Task Failed is displayed in the Status column.
      2. In the Actions column, click View.
      3. In the Execution Details panel, click the Task Failed tab on the Instances tab to view execution results.

        For information about common error messages and the solutions to the errors, see the Command errors and solutions section of this topic.

        Error message
    • View the execution results of a scheduled task.
      1. Find a command task for which Waiting for execution is displayed in the Status column.
      2. In the Actions column, click View.
      3. In the Execution Details panel, view execution results on the Instances tab.

        The following figure shows the execution results of a scheduled command task that is executed every 15 minutes.

        Execution results of a scheduled task

View execution results by using Alibaba Cloud CLI

If you use Cloud Assistant by means of Alibaba Cloud CLI or OpenAPI Explorer, you can call the DescribeInvocations or DescribeInvocationResults operation to query the execution results of Cloud Assistant commands. If an execution fails, you can check ErrorCode and ErrorInfo in the API responses for error details.

In the following examples, the DescribeInvocations and DescribeInvocationResults operations are used to describe how to use Alibaba Cloud CLI to query execution results.

  • Call the DescribeInvocations operation to query the execution state of a command.
    aliyun ecs DescribeInvocations --RegionId TheRegionId --InvokeId your-invoke-id
  • Call the DescribeInvocationResults operation to query the execution results of a command on a specific instance.
    aliyun ecs DescribeInvocationResults --RegionId TheRegionId --InstanceId i-bp1g6zv0ce8og******p --InvokeId your-invoke-id

Command errors and solutions

Error codeError messageRecommended solution
InstanceNotRunningThe error message returned because the instance is not in the Running state while the task is being created. Check whether the instance is running as expected.
InstanceRestartedThe error message returned because the instance was restarted while the task was being executed. Do not restart the instance while the task is being executed.
ClientNotRunningThe error message returned because the Cloud Assistant Agent is not running. The Cloud Assistant Agent is stopped or not installed. Perform the following operations to install or start the Cloud Assistant Agent:
  1. Check whether the process of the Cloud Assistant Agent runs as expected.
    • For Linux instances, run the following command:
      ps -ef |grep aliyun-service
    • For Windows instances, check whether the aliyun_assist_service process exists in the Task Manager.
  2. If the process does not exist, start the Cloud Assistant Agent.
    • For Linux instances, run the following command:
      #If the Linux instances support systemctl, run the following command:
      systemctl start aliyun.service
      
      #If the Linux instances do not support systemctl, run the following command:
      /etc/init.d/aliyun-service start
    • For Windows instances, start AliyunService by using Service Manager.
Note If the Cloud Assistant Agent is still not started after the preceding operations are performed, re-install the Cloud Assistant Agent. For more information, see Install the .
ClientNetworkBlockedThe error message returned because the instance network environment is abnormal.
  1. Run the following command to check network connectivity. If the network is normal, the instance ID is returned.
    curl https://{region-id}.axt.aliyun.com/luban/api/instance/instance-id
  2. If the instance ID is not returned, check the security groups, firewall, DNS configurations, and route tables of the instance to troubleshoot the network issue. You must allow outbound traffic on TCP port 443, TCP port 80, and UDP port 53 to ensure that Cloud Assistant can access the following URLs:
    • https://{region-id}.axt.aliyun.com:443/
    • http://100.100.100.200:80/
    • http://aliyun-client-assist-{region-id}.oss-{region-id}-internal.aliyuncs.com

      The access control list (ACL) of the OSS bucket where the Cloud Assistant Agent installation package is stored is set to private, and only the ACL of the Cloud Assistant Agent installation package is set to public read. If the domain name can be connected, "AccessDenied" is returned when you verify the connectivity of the domain name.

Note
  • {region-id} specifies the region ID of the instance. For example, if the instance resides in the China (Hangzhou) region, set this parameter to cn-hangzhou.
  • For information about the domain names and IP addresses of the Cloud Assistant server in different regions, see Fine-grained configurations.
ClientNotResponseThe error message returned because the Cloud Assistant Agent does not respond. Troubleshoot the issue based on logs of the Cloud Assistant Agent.
  1. Open the log file of the Cloud Assistant Agent. The following section describes the default paths of the log file:
    • Linux instances: /usr/local/share/aliyun-assist/<Version number of Cloud Assistant>/log/aliyun_assist_main.log
    • Windows instances: C:\ProgramData\aliyun\assist\<Version number of Cloud Assistant>\log\aliyun_assist_main.log
  2. Check whether the task ID exists in the log file.
    • If the task ID exists, check whether exception information exists in the context. For example, you can check whether the command is run to completion and reported.
    • If the task ID does not exist, run the Cloud Assistant command again. If the execution fails again, we recommend that you restart the Cloud Assistant Agent.
      • For Linux instances, run one of the following commands:
        #If the Linux instances support systemctl, run the following command:
        systemctl restart aliyun.service
        
        #If the Linux instances do not support systemctl, run the following command:
        /etc/init.d/aliyun-service restart
      • For Windows instances, start AliyunService by using Service Manager.
ClientNeedUpgradeThe error message returned because the Cloud Assistant Agent is not upgraded. Enable auto-upgrade for the Cloud Assistant Agent or manually upgrade the Cloud Assistant Agent. For more information, see Upgrade or disable upgrades for the .
ClientNotOnlineThe error message returned because the Cloud Assistant Agent is not connected to the Cloud Assistant server. Restart the Cloud Assistant Agent. For more information, see Start, stop, or uninstall the . If the Cloud Assistant Agent still cannot connect to the Cloud Assistant server after the client is restarted, submit a ticket.
DeliveryTimeoutThe error message returned because the Cloud Assistant server failed to send the command to the Cloud Assistant Agent. The Cloud Assistant command is not sent to the instance. We recommend that you run the command again. If the issue persists, submit a ticket.
ExecutionTimeoutThe error message returned because the command execution has timed out. Extend the command execution timeout period.
  • If you create and run a command in the ECS console, the Timeout Period parameter is set to 60 seconds by default. Specify an appropriate value.
  • If you run a command by calling the RunCommand operation, the Timeout parameter is set to 60 seconds by default. Specify an appropriate value.
  • If you create a command by calling the CreateCommand operation and run the command by calling the InvokeCommand operation, the Timeout parameter is set to 60 seconds by default when you create the command. Specify an appropriate value when you create the command, or call the ModifyCommand operation to change the value after the command is created.
ExecutionExceptionThe error message returned because an exception occurred while the command was running. Check the error message in the ErrorInfo field. If you cannot identify the issue based on the error message, submit a ticket.
ExitCodeNonzeroThe error message returned because the command execution is complete but the exit code is not 0. Check the command script and the command output.