Updated on 2024-11-20 GMT+08:00

Executing Custom Scripts

The custom script execution capability is provided.

Scenarios

Execute a custom script on COC.

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 Custom Scripts page, locate the script to be executed, click Execute in the Operation column.

    Figure 1 Selecting the customized script to be executed

  3. Enter the script input parameters. The parameter names and default values have been preset when a custom script is entered. During script execution, you can manually enter the script input parameter values or use the parameter warehouse. 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 the parameter warehouse
    Table 1 Parameter association modes

    Parameter Association Mode

    Description

    Use 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.

    If you select parameter warehouse, you need to create the parameters to be selected on the Parameter Management > Parameter Center page.

  4. Enter the execution user and execution timeout interval. Executed by: the user who executes the script on the target instance node. The default user is root. Timeout Interval: the timeout interval for executing the script on a single instance. The default value is 300.
  5. Click + Add instances to add the target instances for script execution. You can search for target instances by name, EIP, or resource status.

    Figure 4 Selecting target instances

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

  7. 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

  8. Click Submit.

    Figure 7 Submitting the request