Updated on 2024-10-29 GMT+08:00

Executing Common Scripts

The capability of executing the common scripts preset by the service is provided.

Common scripts are available to all users. Users can read or execute the common scripts to perform common operations such as clearing disks.

Scenarios

Execute common scripts provided by the service on Cloud Operations Center.

Precautions

Ensure that you have the permission on the component to which the target VM belongs when executing a script.

Procedure

  1. Log in to COC.
  2. In the navigation pane on the left, choose Resource O&M > Automated O&M. In the Routine O&M area, click Scripts. On the the displayed Scripts page, click Common Scripts, locate the script to be executed, click Execute in the Operation column.

    Figure 1 Selecting the target common script to be executed

  3. Complete the script execution information. Input parameters are preset in common scripts and cannot be modified. Set Executed By and Timeout Interval. The default executor is user root and default timeout interval is 300 seconds.

    Script parameters can be manually entered or selected from the parameter repository. (Disk clearing is not supported currently.) If you manually enter a parameter value, you need to select the region where the parameter is located, parameter name, and parameter association mode from Creating a Parameter.
    Figure 2 Manually entering script parameters
    Figure 3 Selecting script parameters from repository
    Table 1 Parameter association modes

    Parameter Association Mode

    Description

    Using the latest parameter value in the corresponding environment

    This parameter is used during script execution. The parameter value is the latest parameter value obtained from the corresponding region in the parameter warehouse in real time.

  4. Click + Add instances to select the target instances. You can search for instances by name, EIP, or resource status.

    Figure 4 Selecting target instances

  5. Select Batch Policy.

    • Automatic: The selected instances are divided into multiple batches based on the default rule.
    • Manual: You can manually divide instances into multiple batches as required.
    • No batch: All target instances are in the same batch.
    Figure 5 Selecting a batch policy

  6. Set Suspension Policy.

    Suspension policy: You can set the execution success rate. When the number of failed instances meets the number calculated based on the execution success rate, the service ticket status becomes abnormal and the service ticket stops being executed.
    Figure 6 Setting a suspension policy

  7. Click Submit.

    Figure 7 Submitting the request