Creating a Script
Standardized common O&M scripts are provided. COC provides public scripts for server initialization, log clearing, and health check, enabling O&M personnel to quickly invoke and optimize the scripts. If the provided public scripts do not meet your service requirements, you can create custom scripts. Custom scripts support Shell, Python, and Bat commands. You can set input parameters for the scripts. By properly designing script logic and parameter configurations, you can ensure that custom scripts not only meet specific requirements, but also improve O&M efficiency and strengthen security.
Constraints
The maximum size of the script content is 100 KB.
Creating a Custom Script
- Log in to COC.
- In the navigation pane, choose Resource O&M > Automated O&M.
- In the Routine O&M area, click Script Management. The script management page is displayed.
- On the displayed Custom Scripts tab page, click Create Script.
- Set basic script information by referring to Table 1.
Table 1 Basic information parameters Parameter
Description
Script Name
Create a script name based on the naming rules.
The value can contain 3 to 100 characters, including letters, digits, hyphens (-), and underscores (_).
Enterprise Project
Select the enterprise project to which the script belongs from the drop-down list.
After the script is created, the enterprise project cannot be modified.
Version
The default version number is 1.0.0. You can specify the script version number. The version number format is x.x.x.
Risk Level
Select High, Medium, or Low based on service requirements.
Description
Enter a description about the script.
The value can contain 1 to 256 characters.
- Set the script content by referring to Table 2.
- (Optional) Set script input parameters by referring to Table 3.
Table 3 Script input parameter description Parameter
Description
Script Input Parameters
Add execution parameters of the script. A maximum of 20 parameters can be added, and the parameter value can contain spaces.
Sensitive
You can select the Sensitive check box to encrypt the parameters.
After this check box is selected, the parameters are desensitized for display and encrypted for storage.
- (Optional) Configure parameters in the Advanced Settings area by referring to Table 4.
Table 4 Additional settings description Parameter
Description
Manual Review
After this function is enabled, the script needs to be reviewed. For details about how to review the script, see Reviewing a Custom Script.
Reviewer
Select Shift or Individual.- Shift: Select a shift scenario and a role from the drop-down lists based on the configured values. For details about how to configure a shift, see Shift Schedule Management.
- Individual: Select a user as the reviewer. For details about how to configure a reviewer, see Personnel Management.
Notification Mode
Select a notification method from the drop-down list.- Default: The notification method selected in the subscription notification settings of the reviewer is used by default. For details about how to set the default notification method, see Selecting a Notification Method.
- SMS, WeCom, DingTalk, Phone, Lark, and Email: Notifications are sent based on the information reserved by the reviewer. For details about how to set the reviewer information, see Modifying Personnel Information.
- No notification: The system does not notify any recipient.
- Click OK. The custom script is created.
After the script is created, you can view the basic information about the script in the script list and perform operations such as reviewing, modifying, executing, and deleting the script. For details, see Managing Scripts.
Helpful Links
- Custom and public scripts can be executed periodically. For details, see Scheduled O&M.
- The COC script management feature enables the standardized, online modification of ECS hostnames. For details, see Changing the ECS Hostname Using a Script.
- You can use COC to create, review, modify, execute, and delete scripts, and manage tags by calling APIs. For details, see Script Management.
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