Create and test scenario
Create scenario
In Monitoring Flow, you can create a scenario step (workflow) by using a scenario. Follow the steps below to create a new scenario.
When creating a scenario, the connected flow connection cannot be modified.
Create a scenario in Monitoring Flow to run a workflow.
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click the [Create scenario] button to open the scenario creation screen.
-
Enter the required information and click the [Create] button.
- After selecting a flow connection, you can check the subnets connected to it. The connected subnets can be modified in the flow connection detail screen.
Item Description Scenario name Duplicate scenario names are not allowed within the same project Flow connection Only VPCs registered in a flow connection can be selected
- Only one flow connection can be selected
- One flow connection can be used in multiple scenarios
- To access KakaoCloud internal resources, a flow connection must be selected, but scenarios can still be created without oneSubnet Only subnets connected to the selected flow connection are visible
- To modify connected subnets, refer to Manage subnet connectionsSchedule Set the schedule to run the scenario
- A schedule must be set for scenario steps to function properly
Scenario step types
You can create a complete scenario by combining the seven available steps (API, TCP, UDP, Set Variables, For, If, Sleep). A scenario step acts as a workflow component within a scenario, and the scenario will only function properly once all steps have been saved.
- Step: A step that constitutes a scenario. Steps are defined and combined to create various scenarios.
- Scenario: Refers to a workflow in KakaoCloud, where defined steps are automated according to a schedule for efficient monitoring.
- Variable: A user-defined variable that can be accessed globally within the workflow.
The scenario step types are as follows.
Item | Description |
---|---|
API | Step that specifies the API to call |
TCP | Step that sends a connection request using the TCP protocol to the specified address |
UDP | Step that sends data using the UDP protocol to the specified address |
Set Variables | Step that sets variable values - Variables are accessible globally during scenario execution - You must create a Default Variable first, then select it in the Set Variables step |
For | Step that sets loop conditions - Supports simple loops and iteration over elements in a JSON list - Maximum of 1,000 iterations - Marker indicates the current position in the Variable result |
If | Step that defines conditions using comparison operators |
Sleep | Step that pauses the process for a defined time - Maximum 5 minutes |
Add scenario steps
- Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
- In the Scenario menu, click the scenario name to go to the detail screen.
- Go to the Details tab and click the [Add scenario step] button at the bottom.
- Add a scenario step in the right panel of the scenario step editor screen.
- If any required fields are missing in a step, a warning icon will appear on that step.
- You cannot save a scenario step without filling in all required fields.
- For specific steps, you must first register a Default Variable.
Manage Default Variables
You can change the number and details of Default Variables. You must register Default Variables before creating a step.
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
Click the [Manage default variable] button at the top right to register Default Variables (up to 20).
-
Enter Key, Type, and Value, then click Save.
Item Description Key Enter the key value of the variable Type Select the variable type
- Choose from String, Integer, JSON List, or JSON MapValue Enter the default value of the variable according to the selected type
You cannot modify or delete a Default Variable that is used in other steps. Be sure to remove the related information from those steps before attempting to edit or delete it.
Configure API step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In the right panel, set the step type to
API
. -
Enter the required API configuration.
Item Category Description Type Select API
Step name Enter the name of the step
- Names cannot be duplicated within the same scenarioExpected code Enter the expected status code of the URL
- Defaults to200
if left emptyMethod Select the API request method URL Enter the API URL to access
- You can use variables (e.g.,${IP}
→ 12.34.56.78, http://${IP}
→ http://12.34.56.78
)Timeout Maximum time to wait for a response after sending the request (in ms)
- Must be between 1 ms and 60,000 msParameters Enter parameters information
- Up to 10 parameters can be storedKey Enter parameter key
- Duplicate keys are not allowedValue Enter parameter value
- Variables allowedHeaders Enter header key/value pairs
- Up to 10 parameters can be storedKey Enter header key
- Duplicate keys are not allowedValue Enter header value
- Variables allowedBody Enter body content
- Variables allowed
- Refer to the example belowBody example{
"name": "kakaocloud",
"org": {
"name": "kakaocloud"
}
} -
After filling in all required fields, click [Add next step] on the left panel if additional steps are needed.
- API steps can be used independently.
- API steps cannot have child steps.
- To delete an API step, make sure that no other step references this API. If other steps contain data from this API, you must remove those references before deletion.
infoYou must allow the following IP in the destination's firewall:
- IP
61.109.236.21
Configure TCP step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In the right panel, set the step type to
TCP
. -
Enter the required TCP configuration.
Item Description Type Select TCP
Step name Enter the name of the step
- Names cannot be duplicated within the same scenarioURL Enter the designated TCP URL to connect to
- You can use variables (e.g.,${IP}
→ 12.34.56.78, tcp://${IP}
→ tcp://12.34.56.78
)Timeout Maximum time to wait for a response after sending the request (in ms)
- Must be between 1 ms and 60,000 ms
- If left empty, the scenario timeout (5 minutes) will be applied
Configure UDP step
The UDP server must send a response using the same address (IP) that sent the request for successful communication.
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In the right panel, set the step type to
UDP
. -
Enter the required UDP configuration.
Item Description Type Select UDP
Step name Enter the name of the step
- Names cannot be duplicated within the same scenarioURL Enter the designated UDP URL to send data to
- You can use variables (e.g.,${IP}
→ 12.34.56.78, udp://${IP}
→ udp://12.34.56.78
)Timeout Maximum time to wait for a response after sending the request (in ms)
- Must be between 1 ms and 60,000 ms
- If left empty, the scenario timeout (5 minutes) will be applied
Configure Set Variables step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In the right panel, set the Type to
Set Variables
and configure the required items.Item Category Description Type Select Set Variables
Step name Enter the name of the step
- Names cannot be duplicated within the same scenarioParameters Enter parameter details
- Up to 5 parameters can be savedVariable Select one variable from the list of Default Variables
- Variables already used in this step cannot be selected again
- If no variable is registered, add it from Default VariableStep Select one API step from the upper steps that store data
- If no API exists in the upper steps, you must create one via Configure API stepRequest/Response Select either response
orrequest
Component Select from parameters, headers, or body depending on request/response Key Enter or select the value from the selected request/response result - Click the [Save] button.
Configure For step
For
step cannot have a Next step.For
step must have a Child step.- If the
For
step is a child of another step, it cannot have either Next or Child steps.- (Example) If the
For
step is a child of anIf
step, theIf
step cannot add Next/Child steps.
- (Example) If the
1 Depth | 2 Depth | 3 Depth |
---|---|---|
API | ||
If | ||
For | ||
Cannot add next step to If | Cannot add child step to If | API |
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In the right panel, set the Type to
For
and configure the required items.Item Category Description Type Select For
Step name Enter the name of the step
- Names cannot be duplicated within the same scenarioCondition Enter the condition appropriate to the type Type Select either count
orforeach
Count Enter the number of repetitions (1–1,000) Foreach Select a Base Variable
- Must be a JSON List from Default Variable
- Only JSON Lists are allowedContinue on Error Decide whether to continue even if an error occurs during this step Marker Indicates the current position in the selected variable result. Used to read data from that position
- Up to 5 marker values can be savedMarker Variable Select one from the Default Variable list
- Variables already used can be selected againMarker Value Enter the position value to read data
- Must use the exact format${marker.}
- Entering onlymarker.
is treated as a string
- JSON array values can be used in variables and functions
- SupportsSubstring
,Size
functions
- Using Marker Value
Item | Example |
---|---|
Default Variable | - key: name / type: string - key: age / type: integer |
Marker Variable | - name - age |
Marker Value | - ${marker.name} - ${marker.age} |
Result | - name = "kakao", "john"- age = 10, 20 |
- Applying functions to Marker Value
Item | Example 1 | Example 2 |
---|---|---|
Get string length | Extract part of string | |
Marker Variable | marker: {"name": [{"i": 1, "str": "bar"}]} | marker: {"name": [{"i": 1, "str": "bar"}]} |
Marker Value | ${size(marker.name[0].str)} | ${marker.name.str.substring(1,3)} |
Result | "3" (length of "bar") | "ar" (substring of "bar" from index 1 to 2) |
- After filling in all required fields, click Add child step from the left panel to add a child step.
- A
For
step must have a Child step and cannot have a Next step.
- A
Configure If step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In the right panel, set the Type to
If
and configure the required items.Item Category Description Type Select If
Step name Enter the name of the step
- Names cannot be duplicated within the same scenarioCondition Enter the condition according to the type
- If the condition is true, the If step will execute the conditions in the given orderLogical Select one of the functions: and
oror
- Only available when more than one condition is setLeft Operand Enter the target condition to compare
- JSON array values can be used with variables and functions
- SupportsSubstring
,Size
functionsComparison Select the comparison operator Right Operand Enter the reference value
- JSON array values can be used with variables and functions
-Regex
can only be used when the comparison operator is set toregex
-
After entering all required fields, click either Next step or Child step in the left panel.
- The
If
step must have at least one Child step.
- The
Configure Sleep step
-
Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
-
Click Scenario > [More] > Edit scenario step.
-
In the right panel, set the Type to
Sleep
and configure the required items.Item Description Type Select Sleep
Step name Enter the name of the step
- Names cannot be duplicated within the same scenarioSleep Time Enter the duration to pause the process
- Maximum allowed: 5 minutes -
After entering all required fields, click either Next step or Child step from the left panel to add additional steps.
Use function in scenario
- Even if an invalid value format is entered in an expression, it will be processed as a string without throwing a step error.
(Example) If the${user.age}
variable contains a string like "abc" instead of a number, the condition${user.age} > 10
will still execute without error, being interpreted as a simple string comparison.
This can result in the condition unintentionally being evaluated as "success", so please check the variable value and format when writing expressions. - If the Marker value used in an expression cannot be found in the specified Variable, the Default Variable value will be used automatically.
You can use functions in expressions for the API, TCP, UDP, For, and If steps.
Function | Description | Available Steps | Notes |
---|---|---|---|
size() | Returns the length of a string or list | API, TCP, UDP, For, If | Causes an error when used on numbers |
substring(start,end) | Slices a string | API, TCP, UDP, For, If | Causes an error when used on arrays or numbers |
regex (~=) | Performs regex comparison | If | Perl-style (left: string, right: regex pattern) |
API, TCP, UDP Steps
var: { "i": 1, "str": "bar", "m": { "foo": "baz" } }
Expression | Result | Description |
---|---|---|
${var}/path | Error | Cannot concatenate object and string |
https://${var.str}.com/path | https://bar.com/path | String interpolation |
https://example.com/${var.i} | https://example.com/1 | Number-to-string conversion |
https://example.com/${size(var.str)} | https://example.com/3 | Using size() |
https://${substring(var.str,1,3)}.com/path | https://ar.com/path | Using substring() |
https://${var.str}.com/${var.i} | https://bar.com/1 | Complex expression |
For Step
Using expressions on values that are not strings or objects can cause errors.
marker: { "foo": [{ "i": 1, "str": "bar" }] }
Expression | Result | Description |
---|---|---|
${marker.foo} | [{"i":1, "str":"bar"}] | Returns full array |
${marker["foo"]} | [{"i":1, "str":"bar"}] | Same as above |
${size(marker.foo)} | 1 | Size of array |
${size(marker.foo[0].i)} | Error | size() cannot be used on numbers |
${size(marker.foo[0].str)} | 3 | size() of "bar" |
${marker.foo.substring(1)} | Error | substring() on array not allowed |
${marker.foo[0].substring(1)} | Error | substring() on object not allowed |
${marker.foo[0].i.substring(1)} | Error | substring() on number not allowed |
${marker.foo[0].str.substring(1)} | ar | Slices from index 1 to end |
${marker.foo[0].str.substring(1, size(marker.foo[0].str)-1)} | a | Slices from index 1 to one before last |
marker: [{ "value": "123" }]
Expression | Result | Description |
---|---|---|
${marker[0]} | {"value": "123"} | Returns the first object |
${marker[0].value} | 123 | Accesses value field |
${marker.value} | Error | Cannot access value directly from array |
If Step
Using expressions on values that are not strings or objects can cause errors.
user: {"name": "alice","age": 27,"info": {"nickname": "ally"}}
Expression | Result | Description |
---|---|---|
${user} = ${user} | True | Compares if both user objects are equal |
${user.name} ~= ^a.* | True | Checks if user.name starts with "a" |
${user.age} ~= ^[0-9]+$ | True | Checks if user.age is a number using regex |
${user.info} ~= .*nickname.* | True | user.info is treated as string and matched by keyword |
${size(user.name)} ~= ^[0-9]+$ | True | Checks if length of name is numeric |
Run Scenario Step Test and Check Results
-
After filling in all required fields for the scenario step, click the [Test] button at the top right to run the test and view the results.
- The test result screen will display the same results as the actual scenario execution.
- If any errors occur per step, check the details at the bottom of the right panel.
-
Be sure to save the scenario either before or after the test.
- Even if no changes are made after the test, if the scenario is not saved, the previously created steps will be lost.
- Unsaved scenario steps cannot be recovered.
- Saved scenario steps will be executed according to the schedule set in the scenario.
- Scenario execution does not occur immediately after saving; some delay is expected.
You can find various use cases for the Monitoring Flow service in our Tutorials. Explore the tutorials below to see concrete examples and detailed setup instructions.