Creating Custom Jobs
Scenarios
You can create custom jobs, including custom scripts, APIs, and process controls. The jobs can be used for global parameters and can be associated with the parameter center.
Precautions
Confirm and fill in the risk level of the operation according to the operation procedure.
Creating a Custom Job
- 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 Job Management.
- In the Custom Jobs tab page, click Create Job.
- Set Basic Information.
Table 1 Basic information parameters Parameter
Description
Example Value
Job
Customize a job name based on the naming rules.
Test_Job
Enterprise Project
Select an enterprise project from the drop-down list.
default
Description
Description of a job.
-
Tag
(Optional) Click Add Tag and enter a tag key and value.
- When you enter a tag key and value, the system automatically displays all predefined tags associated with the current user.
- A tag key can contain up to 128 characters. It cannot start with _sys_ or a space, and cannot end with a space. Only letters, digits, spaces, and the following special characters are allowed: _.:=+-@
- A tag value can contain up to 255 characters. It cannot start or end with a space. Only letters, digits, spaces, and the following special characters are allowed: _ . : / = + - @
-
- Click Next.
- Select a job template. If no proper template is available, select Customize. Click Next.
- Set Job Orchestration.
- Click
to add a new step.
- Click the step name or
on the right of the step name to change the step name.
- Click
on the right of the step name to delete the step.
- Click + Add Task to add a task for the step.
- Click + Operation Type to set the operation type of the current task. The operation type can be Cloud service API Task, Controls, or Custom Scripts.
Table 2 Operation type description Operation Type
Description
Cloud service API Task
Start OS of ECS
You can start ECSs one by one or in batches.
Restart OS of ECS
You can restart ECSs one by one or in batches.
Change OS of ECS
You can change the OS of ECSs one by one or in batches.
Stop OS of ECS
You can stop ECSs one by one or in batches.
Reinstall OS of ECS
You can reinstall ECSs one by one or in batches.
Patch repair
You can repair non-compliant patches on the target instance.
Patch scan
You can scan the patch compliance of the target instance.
Execute API
You can call the OpenAPI of a cloud service registered with API Explorer. If the OpenAPI is called asynchronously, you can use the Wait API atom action to wait until the target object reaches the expected state.
Wait API
It can be used to wait for the target object to reach the expected state. For example, after calling the StartServer API of the ECS using the Execute API atomic action, call the ShowServer API of the ECS using the Wait API atomic action. Wait until the status in the API response becomes ACTIVE, that is, the status is running, then you can confirm that the ECS has been started.
Controls
Review
You can select a shift or an individual for approval.
Pause
You can pause a job. To resume a job, you need to click Continue in the service ticket details.
Sleep
You can make a job sleep. After the sleep time is reached, the ticket continues to be executed.
Custom Scripts
Execute Command
You can run specific commands. The command types include Shell, Python, and Bat. You can customize command content and input parameters.
Execute script
You can select a created custom script. For details about how to create a custom script, see Creating Custom Scripts.
- Set Input, Output, and Troubleshooting.
- Click OK.
- Click + Operation Type to set the operation type of the current task. The operation type can be Cloud service API Task, Controls, or Custom Scripts.
- Click a job name or
next to the job name to change the name.
- Click
- (Optional) Set global parameters.
Global Parameters: Global parameters can be customized or obtained from the parameter center. You can manually set 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.
Table 3 Parameter association modes Parameter Association Mode
Description
Use the current parameter value in all environments
This parameter is used during job execution. The parameter value is that displayed in the parameter basic information when the parameter is added during job creation.
Use the latest parameter value in the corresponding environment
This parameter is used during job execution. The parameter value is the latest parameter value obtained from the parameter center in real time.
- Click Next.
- Set Advanced Settings.
- Risk Level: Select High, Medium, or Low as required.
- Manual Review: If this parameter is enabled, the job needs to be reviewed. For details about how to review, see Approving a Custom Job.
- Reviewer: Shift or Individual.
- Shift: Select a scenario and 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 reviewer. For details about how to configure a reviewer, see O&M Engineer Management.
- Notification Mode: Select a notification mode from the drop-down list.
- Default: Same as that selected in the reviewer subscription function. For details about how to set the default notification mode, 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 reviewer information, see Modifying Personnel Information.
- No notification: The system does not notify any recipient.
- Click OK.
The custom job is created.
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