Executing Public Scripts
Scenarios
Public scripts are predefined scripts. You can clean disks, reset passwords, start or stop OSs with this function. You can only read and execute public scripts.
Precautions
Ensure that you have the permission on the component to which the target VM belongs when executing a script.
Notes and Constraints
A maximum of 999 instances can be selected for a task.
Executing a Public Script
- Log in to COC.
- In the navigation pane on the left, choose Resource O&M > Automated O&M.
- In the Routine O&M area, click Script Management.
- Choose Public Scripts.
- Locate the script to be executed and click Execute in the Operation column.
- Set Script Input Parameters.
- Script Input Parameters: The parameters are preset in public scripts and cannot be modified. The script input parameter values can be set manually or selected from the parameter center. Currently, disk cleansing is not supported. You can manually specify parameter values or select a preset parameter value from the parameter center. Select the region where the parameter is located, parameter name, and parameter association mode.
Figure 1 Manually specifying script parametersFigure 2 Selecting script parameters from the parameter center
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 value is the latest parameter value obtained from the corresponding region in the parameter center in real time.
- Script Input Parameters: The parameters are preset in public scripts and cannot be modified. The script input parameter values can be set manually or selected from the parameter center. Currently, disk cleansing is not supported. You can manually specify parameter values or select a preset parameter value from the parameter center. Select the region where the parameter is located, parameter name, and parameter association mode.
- Set Executed By and Timeout Interval.
- Executed By: root is set by default. It is the user who executes the script on a target instance node.
- Timeout Interval: 300 is set by default. It indicates the timeout interval for executing the script on a single target instance.
- Click Add and configure the parameters on the Select Instance dialog box.
Table 2 Instance parameters Parameter
Description
Example Value
Selection Method
Select an instance selection method.
- Manual Selection: Manually select an instance based on Enterprise Project, View Type, Resource Type, Region, and Target Instance.
Manual Selection
Enterprise Project
Select an enterprise project from the drop-down list. You can choose All.
All
View Type
Select a view type.
- CloudCMDB resources: Select an instance from the resource list.
- CloudCMDB application groups: Select an instance from the application group list.
CloudCMDB resources
Resource Type
The value can be ECS or BMS.
ECS
Region
Select a region from the drop-down list.
CN-Hong Kong
Target Instance
Set filter criteria in the filter box and select the filtered instances.
-
- Configure Batch Policy and Suspension Policy.
- Batch Policy: Select Automatic, Manual, or No Batch.
- Automatic: The selected instances to be executed are automatically divided into multiple batches based on the preset rule.
- Manual: You can manually create multiple batches and add instances to each batch as required.
- No Batch: All instances will be executed in the same batch.
- Suspension Policy:
- You can set the execution success rate. When the number of failed hosts reaches the number failed ones that are calculated based on the execution success rate, the service ticket status becomes abnormal and the service ticket stops being executed.
- The success rate ranges from 0 to 100 and supports accuracy up to one decimal place.
- Batch Policy: Select Automatic, Manual, or No Batch.
- Click OK. On the displayed page, click OK.
- Perform the following operations to check whether a service ticket execution is complete.
- For the service tickets that are being executed:
- If you want to pause the next batch when the current batch is executed, click Pause in the upper right corner.
- If you want to continue the paused batch, click Continue in the upper right corner.
- If you want to stop the service ticket that is about to be executed or is abnormal, click Forcibly End.
- For the service tickets that are executed:
- If some or all instance tasks in the service tickets are executed abnormally:
- Click the Abnormal tab in the Execution Information area. Locate an abnormal batch and click Retry in the Operation column.
- Click the Abnormal tab in the Execution Information area. Locate an abnormal batch and click Cancel in the Operation column.
- If all instance tasks in the service tickets are executed successfully, no more operation is needed.
- If some or all instance tasks in the service tickets are executed abnormally:
- For the service tickets that are being executed:
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot