Updated on 2024-04-19 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 Automated O&M. Click Scripts and click the Common Scripts tab. On the displayed page, locate the target 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 stored in 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 Parameter Warehouse.
    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 to select the target instances. You can search for instances by name, EIP, or resource status.

    Figure 4 Selecting target instances

  5. Select a 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 instances to be executed are in the same batch.
    Figure 5 Selecting a batch policy

  6. Set a 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