tencent cloud

Feedback

Expanding Fault Injection Actions with Custom Scripts

Last updated: 2024-09-26 15:49:18
    To meet users' personalized fault action needs, CFG has developed custom actions. You can package fault scripts as a fault action for experiment orchestration. During experiment execution, custom actions are distributed to the selected CVM for execution. Additionally, custom actions support dynamic parameter configuration and action resource sharing under the root account, allowing for creation once and multiple uses. Below is an introduction about how to use custom actions with custom scripts to kill the specified process.
    During the operation of the business, processes may terminate due to various unexpected situations. To verify whether the service can automatically restart, you can use a custom script to simulate this scenario by killing the process.

    Directions

    Step 1: Create an action

    Log in to Tencent Smart Advisor > Chaotic Fault Generator, select Action Library Management, and click Create Custom Action.

    Step 2: Fill in action basic information

    1. Fill in the basic information for the custom action:
    Note:
    Custom actions support two command types:
    Shell: means Linux script commands.
    Powershell: means Windows script commands.
    Command content supports dynamic parameter replacement. Use {{}} to enclose parameters that need to be dynamically replaced in the script, then click Use Parameters to automatically extract dynamic parameters.
    ps -ef | grep -w {{process_name}} | grep -v grep | awk '{print $2;}' | xargs kill -9
    2. Click Save to see the newly created custom action in the action list. If you have more granular permission management needs, you can specify tags during creation so that only sub-users under the same tag can share the custom action.

    Step 3: Create an experiment

    1. Enter the Experiment Management page and click Create a New Experiment.
    2. Custom actions can participate in experiment orchestration. During experiment creation, click Skip and create a blank experiment, then fill in the experiment details and add experiment Instances.
    3. Click Add Now, and select the experiment action to add.
    4. After selecting the relevant custom action, click Next.
    5. Set dynamic parameters. If not set, default values for creation will be used.
    Custom actions will be distributed to the corresponding CVM instances. If multiple instances are chosen, the script can be distributed for batch parallel execution.

    Step 4: Execute the experiment

    After completing experiment orchestration, click Execute Experiment. If the action is executed successfully (Return code 0 indicates success.), you can log in to the server for verification.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support