本文介绍CreateExperiment、UpdateExperiment、ExecuteExperiment接口的入参Definition。

CreateExperiment、UpdateExperiment接口的入参Definition说明

CreateExperiment、UpdateExperiment的入参Definition示例如下:

{
  "runMode":"SEQUENCE",
  "duration":600,
  "flowGroups":
    [{
      "hosts":["192.168.0.1"],
      "flows":
             [{
               "attack":
                  {
                  "appCode":"chaos.cpu.fullload",
                  "userCheck":true,
                  "arguments":
                       {
                         "cpu_count":"1",
                         "namespcae":"default"
                       }
                  }
              }],
      "appName":"demo",
      "appGroups":["demo-group"]
     }]
}

Definition中涉及的参数如下所示。

名称 类型 是否必选 示例值 描述
runMode Enum SEQUENCE 运行模式:
  • SEQUENCE(顺序执行)。
  • PHASE(阶段执行)。
duration Long 180 自动恢复时间(秒)。
flowGroups List<FlowGropup> [{"hosts":["192.168.0.1"],"flows":[{"attack":{"appCode":"chaos.cpu.fullload","userCheck":true,"arguments":{"cpu_count":"1","namespcae":"default"}}}],"appName":"demo","appGroups":["demo-group"]}] 微流程组。
appName String demo 应用名称。
appGroups List<String> ["demo-group"] 应用分组名称。
hosts List<String> ["192.168.0.1"] 机器列表。
flows List<Flow> [{"attack":{"appCode":"chaos.cpu.fullload","userCheck":true,"arguments":{"cpu_count":"1","namespcae":"default"}}}] 微流程。
prepare List<FlowActicity> {"appCode":"chaos.jvm.install","userCheck":true,"arguments":{"process":"java"}} 准备阶段。
appCode String chaos.jvm.install 小程序编码。
activityName String CPU满载 小程序名称。
userCheck Boolean true 是否手动推进演练(默认为true)。
arguments Map<String,String> {"process":"java"} 小程序配置参数。
attack FlowInfo {"appCode":"chaos.cpu.fullload","userCheck":true,"arguments":{"cpu_count":"1","namespcae":"default"}} 注入阶段。
appCode String chaos.cpu.fullload 小程序编码。
activityName String CPU满载 小程序名称。
userCheck Boolean true 是否手动推进演练(默认为true)。
arguments Map<String,String> {"cpu_count":"1","namespcae":"default"} 小程序配置参数。
check List<FlowActicity> {"appCode":"mkapp.metric.net.packet.dropped","userCheck":true} 验证阶段。
appCode String "mkapp.metric.net.packet.dropped 小程序编码。
activityName String CPU满载 小程序名称。
userCheck Boolean true 是否手动推进演练(默认为true)。
arguments Map<String,String> {"cpu_count":"1","namespcae":"default"} 小程序配置参数。
recover List<FlowActicity> {"appCode":"chaos.jvm.uninstall","userCheck":true} 恢复阶段。
appCode String chaos.jvm.uninstall 小程序编码。
activityName String CPU满载 小程序名称。
userCheck Boolean true 是否手动推进演练(默认为true)。
arguments Map<String,String> {"cpu_count":"1","namespcae":"default"} 小程序配置参数。
groupName String 默认分组1 微流程组名称(若不填写会生成默认名称)。

ExecuteExperiment接口的入参Definition说明

ExecuteExperiment接口的入参Definition示例如下:

{
  "param":
   [{
     "groupId":"1234567890123456789",
     "appName":"ahas-default-node",
     "appGroups":["AHAS杭州预发环境"],
     "hosts":["192.168.0.205"],
     "activityParam":
        [{
          "flowId":"1234567890123456789",
          "appCode":"chaos.cpu.fullload",
          "arguments":
             {
             "cpu_count":"1",
             "namespace":"default"
             }
        }]
    }]
}

Definition中涉及的参数说明如下。

名称 类型 是否必选 示例值 描述
groupId String 1234567890123456789 微流程组ID。
appName String demo 应用名称。
appGroups List<String> ["demo-group"] 应用分组名称。
hosts List<String> ["192.168.0.1"] 机器列表。
activieyParam ActivityRunApiParam [{"flowId":"1234567890123456789","appCode":"chaos.cpu.fullload","arguments":{"cpu_count":"1","namespace":"default"}}] 小程序配置参数。
flowId String 1234567890123456789 微流程ID。如果不填,默认为修改第一个为微流程。
appCode String chaos.cpu.fullload 小程序编码。
arguments Map<String,String> {"cpu_count":"1","namespace":"default"} 小程序配置参数。