Updated on 2024-04-19 GMT+08:00

Creating a Custom Script

The custom script creation capability is provided. Shell, Python, and BAT scripts can be created.

Scenarios

Create a custom script on Cloud Operations Center.

Precautions

Confirm and complete the risk level of the script content.

Procedure

  1. Log in to COC.
  2. In the navigation pane on the left, choose Automated O&M. Click Scripts, click the Custom Scripts tab, and click Create Script.

    Figure 1 Clicking Create Script

  3. Enter the basic script information.

    Figure 2 Setting parameters

  4. Enter the script content. The script type can be Shell, Python, or Bat. And verify high-risk commands in the script.

    Figure 3 Entering the script content

  5. Click Verify High-Risk Command.

    • Verification scope: the high-risk commands involved in the detection. You can click High-Risk Commands to view the verification rules.
    • Verification rule: Within the verification scope, the script content is matched with high-risk commands using regular expression matching.
    • Verification result: The regular expression is used to check whether the script content is high-risk, that is, low-risk or high-risk.

      The result of high-risk command verification is used only as a reference for grading the script risk level. The system does not forcibly require the consistency between script risk level and the verification result. Evaluate the risk level based on the actual service impact.

      Figure 4 Verifying high-risk commands

  6. Enter the script input parameters. You can select the Sensitive check box to encrypt the parameters.

    Figure 5 Entering script input parameters

  7. Enable Manual Review. This switch is enabled automatically for high-risk scripts.

    Figure 6 Selecting the reviewer and the notification mode

  8. Click Submit.

    Figure 7 Submitting the request