Create and test scenarios
Create scenario
In Monitoring Flow, you can create scenario steps (workflow) using scenarios. The steps to create a new scenario are as follows.
Once a scenario is created, the connected flow connection cannot be modified.
Create a scenario to run workflows in Monitoring Flow.
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click the [Create scenario] button to proceed to the scenario creation screen.
-
Enter the required information and click the [Create] button.
- After selecting the flow connection, you can view the subnets connected to the flow connection. The connected subnet can be modified in the flow connection details.
Item Description Scenario name Duplicate scenario names cannot be used within the same project. Flow connection Only VPCs registered with the flow connection can be selected, and only one flow connection can be selected.
- A single flow connection can have multiple scenarios.
- To access internal resources within KakaoCloud, a flow connection must be selected, but scenarios can also be created without a flow connection.Connected subnet Only subnets connected to the selected flow connection can be viewed.
- To modify the connected subnet, refer to Manage subnet connections.Schedule Set the schedule to run the scenario.
- Schedule setting is required for proper scenario step operation.
Step-by-step scenario
A scenario can be completed by combining the five steps (API, Set Variables, For, If, Sleep). Scenario steps are workflows that compose the scenario, and scenarios must be saved to function properly.
- Step: The stages that make up a scenario, defined and combined to create various scenarios.
- Scenario: A term in KakaoCloud that refers to workflows, where steps are automated according to a schedule for efficient monitoring.
- Variable: A term referring to user-defined variables, which can be commonly accessed within workflows.
The types of scenario steps are as follows.
Item | Description |
---|---|
API | Step to specify the API to call. |
Set Variables | Step to set the values of variables. - Variables can be commonly accessed during scenario execution. - After creating a default variable, variables can be selected in the Set Variables step. |
For | Step to set the repetition condition. - Supports simple repetition and iteration over JSON lists, with a maximum of 1,000 repetitions. - The marker represents the current position within the variable result. |
If | Step to set conditions using comparison operators. |
Sleep | Step to pause the process by setting a delay time. - Can be set to a maximum of 5 minutes. |
Add scenario steps
- Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
- Click the scenario name to go to the scenario details screen.
- Go to the Details tab, then click the [Add scenario step] button at the bottom.
- From the right panel of the scenario step editor, add scenario steps.
- If any required fields are missing in a scenario step, a warning icon will appear next to the step.
- Scenario steps cannot be saved if required fields are not entered. Be sure to fill in all required fields.
- When configuring certain steps, a default variable must be registered in advance.
Manage default variable
You can change the number and information of default variables. Default variables must be registered before creating steps.
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
Click the [Manage default variable] button in the top right to register default variables (up to 20).
-
Enter key, type, and value, then save.
Item Description Key Enter the key value for the variable. Type Select the variable type.
- Choose from String, Integer, JSON List, or JSON Map.Value Enter the default value that matches the selected type.
Default variables that contain data used in other steps cannot be modified or deleted. Be sure to delete the data from the relevant steps before attempting to edit the default variable.
Configure API step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In New step settings, select
API
as the step type. -
Enter the required information for the API configuration.
Item Category Description Type Select API
.Step name Enter a name for the step.
- Duplicate names cannot be used within the same scenario.Expected code Enter the expected status code of the URL.
- If not entered, it will default to200
.Method Select the API request method. URL Enter the URL of the API to be accessed.
- Variables can be used in the URL (e.g.,${IP}
→ 12.34.56.78, http://${IP}
→ http://12.34.56.78
).Parameters Enter parameters.
- Up to 10 parameters can be saved.Key Enter the parameter key.
- Duplicate keys cannot be saved.Value Enter the parameter value.
- Variables can be used in the value.Headers Enter headers key/value.
- Up to 10 parameters can be saved.Key Enter the header key.
- Duplicate keys cannot be saved.Value Enter the header value.
- Variables can be used in the value.Body Enter the body value.
- Variables can be used.
- Refer to the body example below.{
"name": "kakaocloud",
"org": {
"name": "kakaocloud"
}
} -
After entering all required fields, if additional steps are needed, click [Add next step] button on the left panel.
- The API step can also be used alone.
- Sub-steps cannot be added to the API step.
- To delete the API step, ensure that no other step stores the API information. If other steps store information from the API you wish to delete, be sure to remove that information before deleting the API step.
infoThe destination’s firewall must allow the following IP:
- IP
61.109.236.21
Configure Set Variables step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In New step settings on the right panel, select
Set Variables
as the step type and configure the following fields.Item Category Description Type Select Set Variables
.Step name Enter a name for the step.
- Duplicate names cannot be used within the same scenario.Parameters Enter the following parameter fields.
- Up to 5 parameters can be saved.Variable Select one from the list of Default Variables.
- Variables already used in the step cannot be selected again.
- If no variables are saved, add one in Default Variable.Step Select one API step stored in the upper steps.
- If no API steps exist, create one in Configure API step.Request/Response Select either request or response. Component Depending on the request/response, select parameters, headers, or body. Key Enter or select a value for the chosen request/response. -
Click the [Save] button.
Configure For step
-
The For step cannot have a
next step
. -
The For step must have a
sub-step
. -
If the For step is a sub-step, it cannot have a
next step
orsub-step
.- (Example) If a For step is added as a sub-step of an If step, the If step cannot have a next/sub-step.
1 Depth 2 Depth 3 Depth API If For Next step for If not allowed Sub-step for If not allowed API
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In New step settings on the right panel, select
For
as the step type and configure the following fields.Item Category Description Type Select For
.Step name Enter a name for the step.
- Duplicate names cannot be used within the same scenario.Condition Enter conditions based on the selected type. Type Select either count
orforeach
.Count Enter the number of repetitions, up to 1,000.
- Enter the number of simple repetitions for the For step (1–1,000).Foreach Select a Base Variable.
- Choose a JSON List from Default Variables to iterate over multiple JSON list data.
- Select one from the list of Default Variables.
- Only JSON Lists can be selected.Continue on Error Set whether to continue execution if errors occur.
- If set, the For step will continue running even if an error occurs.Marker The current position within the selected variable’s result. Markers allow reading data from the specified position.
- Up to 5 marker values can be stored.Marker Variable Select one from the list of Default Variables.
- Variables already used can be selected again.Marker Value Enter a value to read data from the specified position.
- Must start withmarker
.infoMarker values indicate the current position in the selected variable’s result, allowing data to be read from that point. Example:
Item Example Default Variable - key: name / type: string
- key: age / type: integerMarker Variable - ${name}
-${age}
Marker Value - marker.name
- marker.ageResult - ${name}
= “kakao”, “john”
-${age}
= 10, 20 -
After entering all the required fields for the For step, click Add sub-step on the left panel to add a sub-step.
- The For step cannot have a next step, and it must have a sub-step.
Configure If step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In New step settings on the right panel, select
If
as the step type and configure the following fields.Item Category Description Type Select If
.Step name Enter a name for the step.
- Duplicate names cannot be used within the same scenario.Condition Enter the condition based on the selected type.
- If the condition is true, the If step executes its conditions in the given order.Logical Select either and
oror
.
- This is available only when more than one condition is saved.Left Operand Enter the condition target for the operation.
- Variables can be used.Comparison Select the comparison operator for the operand. Right Operand Enter the reference value.
- Variables can be used. -
After entering all required fields for the If step, click [Add next step] or [Add sub-step] button on the left panel.
- The If step must have a sub-step.
Configure Sleep step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In New step settings on the right panel, select
Sleep
as the step type and configure the following fields.Item Description Type Select Sleep
.Step name Enter a name for the step.
- Duplicate names cannot be used within the same scenario.Sleep time Enter the sleep time.
- Maximum of 5 minutes. -
After entering all required fields for the Sleep step, click [Add next step] button or [Add sub step] button on the left panel.
Run scenario step test and check results
-
After entering all required fields for the scenario step, click the [Test] button at the top right and check the test results.
- The test results screen is the same as the actual scenario execution result.
- If there are any errors in the steps, check the error details at the bottom of the right panel.
-
After or before checking the test results, make sure to save the scenario.
caution- If you do not save after testing, the previously created steps will be lost.
- Unsaved scenario steps cannot be recovered.
-
The saved scenario steps will be executed according to the schedule set in the scenario.
- The scenario does not run immediately after saving, and it may take some time to execute.