- Service Overview
- Billing
- Getting Started
-
User Guide
- COC Enablement and Permissions Granting
- Overview
-
Resources
- Resource Management
-
Application Management
- Overview
- Creating an Application
- Modifying an Application
- Deleting an Application
- Application Topology
- Creating a Component
- Modifying a Component
- Deleted a Component
- Creating a Group
- Modifying a Group
- Deleting a Group
- Manually Associating with Resources
- Automatically Associating with Resources
- Transferring Resources
- Disassociating Resources from an Application Group
- Viewing Resource Details
- Viewing Capacity Details
- Batch Resource Operations
- Automated O&M
-
Faults
- Alarms
-
Incident Management
- Overview
- Creating an Incident
- Rejecting an Incident
- Restarting an Incident
- Forwarding Incidents
- Handling Incidents
- Escalating/De-escalating an Incident
- Adding Remarks
- Starting a War Room
- Handling an Incident
- Verifying Incident
- Creating an Improvement Ticket For An Incident
- Managing Fault Review Tasks
- Application Diagnosis
- Incident History
- War Room Management
- Improvement Ticket Management
-
Issue Ticket Management
- Overview
- Creating Issue Tickets
- Rejecting Issues Tickets
- Resubmitting Issue Tickets
- Cancelling Issue Tickets
- Forwarding Issue Tickets
- Accepting Issue Tickets
- Escalating and De-escalating Issue Tickets
- Suspending Issue Tickets
- Locating Issue Tickets and Developing Solutions
- Completing Live Network Implementation Changes
- Verifying Issue Tickets
- Viewing Handling History of Issue Tickets
- Alarm Conversion Rule Management
- Data Source Management
- Change Management
- Resilience Center
- Task Management
- Basic Configurations
- Viewing Logs
- Best Practices
- API Reference
-
FAQs
- Product Consulting
- Resource Management FAQs
-
FAQs About Resource O&M
-
Patch Management FAQs
- What Can I Do If the Patch Baselines Do Not Take Effect?
- What Are the Differences Between the Installation Rule Baselines And User-defined Baselines?
- What Can I Do If Exception all mirrors were tried Is Recorded in the Patch Service Ticket Log?
- Why Can't I Select a Node?
- What Can I Do If the Compliance Report Still Reports Non-compliance for a Patch After the Patch Has Been Repaired?
- What Can I Do If the lsb_release not found Error Occurs During Patch Operations?
- Automation FAQs
- Batch Operation FAQs
- FAQs About Parameter Management
- Resource O&M Permissions and Supported Actions
-
Patch Management FAQs
- FAQs About Fault Management
- FAQs About Change Ticket Management
- Resilience Center FAQs
- Change History
- General Reference
Copied.
Executing Customized Scripts
Function
This API is used to execute a script.
A maximum of 20 script input parameters, timeout interval, execution user, and resource restriction script input parameters are supported. A maximum of 200 hosts can be delivered at a time. The maximum number of hosts in a batch is 10. The maximum number of batches is 20. The maximum size of logs generated by the script can only be 1 MB.
URI
POST /v1/job/scripts/{script_uuid}
Parameter |
Mandatory or Not |
Type |
Description |
---|---|---|---|
script_uuid |
Yes |
String |
Script UUID. |
Request Parameters
Parameter |
Mandatory or Not |
Type |
Description |
---|---|---|---|
execute_param |
Yes |
ScriptExecuteParam object |
Script execution parameters |
execute_batches |
Yes |
Array of ExecuteInstancesBatchInfo objects |
Target instance batch information |
Parameter |
Mandatory or Not |
Type |
Description |
---|---|---|---|
resourceful |
Yes |
Boolean |
Whether resources are limited. The value true indicates that resources are not limited, and the value false indicates that resources are limited. |
timeout |
Yes |
Integer |
Timeout interval, in seconds. The value range is to be determined. The value is greater than 5 and less than 1800. Minimum value: 5 Maximum value: 1800 |
success_rate |
Yes |
Double |
Success rate. The value can contain one decimal place. Minimum value: 1 Maximum value: 100 |
execute_user |
Yes |
String |
User who executes the script. The script must be executed by user root. Minimum length: 1 character Maximum length: 32 characters |
script_params |
No |
Array of ScriptExecuteInputParam objects |
Script input parameter list |
Parameter |
Mandatory or Not |
Type |
Description |
---|---|---|---|
param_name |
Yes |
String |
Name of a script input parameter. The parameter name must be unique in the same script. Minimum length: 1 character Maximum length: 64 characters |
param_value |
Yes |
String |
Value of the script input parameter. Minimum length: 0 character Maximum length: 1,024 characters The value can be:
|
param_order |
Yes |
Integer |
Parameter sequence. The value starts from 1 and must be consecutive. Minimum value: 1 Maximum value: 20 |
Parameter |
Mandatory or Not |
Type |
Description |
---|---|---|---|
batch_index |
Yes |
Integer |
Batch index. The value starts from 1. Minimum value: 1 Maximum value: 20 |
target_instances |
Yes |
Array of ExecuteResourceInstance objects |
Target node list Array length: 1 to 10 characters |
rotation_strategy |
Yes |
String |
Suspension and resumption policy The value can be:
|
Parameter |
Mandatory or Not |
Type |
Description |
---|---|---|---|
resource_id |
Yes |
String |
ECS ID Minimum length: 1 character Maximum length: 64 characters |
agent_sn |
Yes |
String |
UniAgent_sn Minimum length: 1 character Maximum length: 32 characters |
project_id |
Yes |
String |
Project ID Minimum length: 1 character Maximum length: 32 characters |
region_id |
Yes |
String |
Region to which the server belongs Minimum length: 1 character Maximum length: 32 characters |
Response Parameters
Status code: 204
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code Minimum length: 8 characters Maximum length: 36 characters |
error_msg |
String |
Error description Minimum length: 2 characters Maximum length: 512 characters |
Request Example
https://coc.myhuawei.com/v1/job/scripts/{script_uuid}
{
"execute_param" : {
"timeout" : 300,
"execute_user" : "root",
"success_rate" : "100.0",
"script_params" : [ {
"param_name" : "a",
"param_value" : "key1",
"param_order" : 1
} ]
},
"execute_batches" : [ {
"batch_index" : 1,
"rotation_strategy" : "CONTINUE",
"target_instances" : [ {
"resource_id" : "resource_id",
"agent_sn" : "agent_sn",
"agent_status" : "ONLINE",
"region_id" : "cn-north-7",
"project_id" : "project_id"
} ]
} ]
}
Response Example
Status code: 200
execute_uuid
{
"data" : "SCT2023083109562601af694bf"
}
Status code: 204
{
"error_code" : "COC.00040701",
"error_msg" : "error_msg"
}
Status Code
Status Code |
Description |
---|---|
200 |
execute_uuid |
204 |
Error information is included. |
Error code
See Error code.
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