Search and Recover Experiments of Chaosd

    This section introduces how to use command-line mode and service mode to find experiments of Chaosd.

    By running the following command, you can view the configurations supported by the command:

    Configuration description

    Example

    1. ./chaosd search --kind network --status destroyed --limit 1

    By running this command, you can search the experiments of the kind of network in the status of destroyed (indicating that the experiment has been recovered).

    After running the command, only one row of data is output in the result:

    1. --------------------------------------- --------- -------- ----------- --------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    2. 1f6c1253-522a-43d9-83f8-42607102b3b9 network delay destroyed 2021-11-02T15:14:07+08:00 {"schedule":"","duration":"","action":"delay","kind":"network","uid":"1f6c1253-522a-43d9-83f8-42607102b3b9","latency":"2s","jitter":"0ms","correlation":"0","device":"eth0","ip-address":"220.181.38.251","ip-protocol":"all"}

    Currently, the service mode only supports searching all experiments. You can get the data by visiting the /api/experiments/ path of Chaosd service.

    Example

      Recover experiments of Chaosd

      After creating an experiment, if you want to withdraw the impact caused by the experiment, you can use the recovery feature of experiments.

      You can recover an experiment by using Chaosd recover UID.

      The following example shows how to recover an experiment using the command-line mode.

      1. Create a CPU stress experiment using Chaosd:

        1. chaosd attack stress cpu --workers 2 --load 10

        The result is as follows:

      2. When you do not need to simulate the CPU stress scenario anymore, use the recover command to recover the experiment corresponding to the UID:

        1. chaosd recover 4f33b2d4-aee6-43ca-9c43-0f12867e5c9c

      You can recover an experiment by sending a DELETE HTTP request to the /api/attack/{uid} path of Chaosd service.

      The following example shows how to recover an experiment using the service mode.

      1. Send a POST HTTP request to the Chaosd service to create a CPU stress experiment: