Skip to main content

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.

info

When creating a scenario, the connected flow connection cannot be modified.

Create a scenario in Monitoring Flow to run a workflow.

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click the [Create scenario] button to open the scenario creation screen.

  3. 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.
    ItemDescription
    Scenario nameDuplicate scenario names are not allowed within the same project
    Flow connectionOnly 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 one
    SubnetOnly subnets connected to the selected flow connection are visible
    - To modify connected subnets, refer to Manage subnet connections
    ScheduleSet 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.

Terminology
  • 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.

ItemDescription
APIStep that specifies the API to call
TCPStep that sends a connection request using the TCP protocol to the specified address
UDPStep that sends data using the UDP protocol to the specified address
Set VariablesStep 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
ForStep 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
IfStep that defines conditions using comparison operators
SleepStep that pauses the process for a defined time
- Maximum 5 minutes

Add scenario steps

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.
  2. In the Scenario menu, click the scenario name to go to the detail screen.
  3. Go to the Details tab and click the [Add scenario step] button at the bottom.
  4. Add a scenario step in the right panel of the scenario step editor screen.
info
  • 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.

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click Scenario > [More] > Edit scenario step.

  3. Click the [Manage default variable] button at the top right to register Default Variables (up to 20).

  4. Enter Key, Type, and Value, then click Save.

    ItemDescription
    KeyEnter the key value of the variable
    TypeSelect the variable type
    - Choose from String, Integer, JSON List, or JSON Map
    ValueEnter the default value of the variable according to the selected type
caution

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

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click Scenario > [More] > Edit scenario step.

  3. In the right panel, set the step type to API.

  4. Enter the required API configuration.

    ItemCategoryDescription
    TypeSelect API
    Step nameEnter the name of the step
    - Names cannot be duplicated within the same scenario
    Expected codeEnter the expected status code of the URL
    - Defaults to 200 if left empty
    MethodSelect the API request method
    URLEnter the API URL to access
    - You can use variables (e.g., ${IP} → 12.34.56.78, http://${IP} → http://12.34.56.78)
    TimeoutMaximum time to wait for a response after sending the request (in ms)
    - Must be between 1 ms and 60,000 ms
    ParametersEnter parameters information
    - Up to 10 parameters can be stored
    KeyEnter parameter key
    - Duplicate keys are not allowed
    ValueEnter parameter value
    - Variables allowed
    HeadersEnter header key/value pairs
    - Up to 10 parameters can be stored
    KeyEnter header key
    - Duplicate keys are not allowed
    ValueEnter header value
    - Variables allowed
    BodyEnter body content
    - Variables allowed
    - Refer to the example below
    Body example
    {
    "name": "kakaocloud",
    "org": {
    "name": "kakaocloud"
    }
    }
  5. 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.
    info

    You must allow the following IP in the destination's firewall:

    • IP 61.109.236.21

Configure TCP step

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click Scenario > [More] > Edit scenario step.

  3. In the right panel, set the step type to TCP.

  4. Enter the required TCP configuration.

    ItemDescription
    TypeSelect TCP
    Step nameEnter the name of the step
    - Names cannot be duplicated within the same scenario
    URLEnter 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)
    TimeoutMaximum 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

caution

The UDP server must send a response using the same address (IP) that sent the request for successful communication.

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click Scenario > [More] > Edit scenario step.

  3. In the right panel, set the step type to UDP.

  4. Enter the required UDP configuration.

    ItemDescription
    TypeSelect UDP
    Step nameEnter the name of the step
    - Names cannot be duplicated within the same scenario
    URLEnter 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)
    TimeoutMaximum 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

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click Scenario > [More] > Edit scenario step.

  3. In the right panel, set the Type to Set Variables and configure the required items.

    ItemCategoryDescription
    TypeSelect Set Variables
    Step nameEnter the name of the step
    - Names cannot be duplicated within the same scenario
    ParametersEnter parameter details
    - Up to 5 parameters can be saved
    VariableSelect 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 Variable
    StepSelect 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 step
    Request/ResponseSelect either response or request
    ComponentSelect from parameters, headers, or body depending on request/response
    KeyEnter or select the value from the selected request/response result
    1. Click the [Save] button.

Configure For step

info
  • 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 an If step, the If step cannot add Next/Child steps.
1 Depth2 Depth3 Depth
API
If
For
Cannot add next step to IfCannot add child step to IfAPI
  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click Scenario > [More] > Edit scenario step.

  3. In the right panel, set the Type to For and configure the required items.

    ItemCategoryDescription
    TypeSelect For
    Step nameEnter the name of the step
    - Names cannot be duplicated within the same scenario
    ConditionEnter the condition appropriate to the type
    TypeSelect either count or foreach
    CountEnter the number of repetitions (1–1,000)
    ForeachSelect a Base Variable
    - Must be a JSON List from Default Variable
    - Only JSON Lists are allowed
    Continue on ErrorDecide whether to continue even if an error occurs during this step
    MarkerIndicates the current position in the selected variable result. Used to read data from that position
    - Up to 5 marker values can be saved
    Marker VariableSelect one from the Default Variable list
    - Variables already used can be selected again
    Marker ValueEnter the position value to read data
    - Must use the exact format ${marker.}
    - Entering only marker. is treated as a string
    - JSON array values can be used in variables and functions
    - Supports Substring, Size functions
info
  • Using Marker Value
ItemExample
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
ItemExample 1Example 2
Get string lengthExtract part of string
Marker Variablemarker: {"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)
  1. 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.

Configure If step

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click Scenario > [More] > Edit scenario step.

  3. In the right panel, set the Type to If and configure the required items.

    ItemCategoryDescription
    TypeSelect If
    Step nameEnter the name of the step
    - Names cannot be duplicated within the same scenario
    ConditionEnter the condition according to the type
    - If the condition is true, the If step will execute the conditions in the given order
    LogicalSelect one of the functions: and or or
    - Only available when more than one condition is set
    Left OperandEnter the target condition to compare
    - JSON array values can be used with variables and functions
    - Supports Substring, Size functions
    ComparisonSelect the comparison operator
    Right OperandEnter the reference value
    - JSON array values can be used with variables and functions
    - Regex can only be used when the comparison operator is set to regex
  4. 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.

Configure Sleep step

  1. Go to KakaoCloud Console > Management > Monitoring Flow > Scenario.

  2. Click Scenario > [More] > Edit scenario step.

  3. In the right panel, set the Type to Sleep and configure the required items.

    ItemDescription
    TypeSelect Sleep
    Step nameEnter the name of the step
    - Names cannot be duplicated within the same scenario
    Sleep TimeEnter the duration to pause the process
    - Maximum allowed: 5 minutes
  4. After entering all required fields, click either Next step or Child step from the left panel to add additional steps.

Use function in scenario

info
  • 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.

FunctionDescriptionAvailable StepsNotes
size()Returns the length of a string or listAPI, TCP, UDP, For, IfCauses an error when used on numbers
substring(start,end)Slices a stringAPI, TCP, UDP, For, IfCauses an error when used on arrays or numbers
regex (~=)Performs regex comparisonIfPerl-style (left: string, right: regex pattern)

API, TCP, UDP Steps

value
var: { "i": 1, "str": "bar", "m": { "foo": "baz" } }
ExpressionResultDescription
${var}/pathErrorCannot concatenate object and string
https://${var.str}.com/pathhttps://bar.com/pathString interpolation
https://example.com/${var.i}https://example.com/1Number-to-string conversion
https://example.com/${size(var.str)}https://example.com/3Using size()
https://${substring(var.str,1,3)}.com/pathhttps://ar.com/pathUsing substring()
https://${var.str}.com/${var.i}https://bar.com/1Complex expression

For Step

Using expressions on values that are not strings or objects can cause errors.

value
marker: { "foo": [{ "i": 1, "str": "bar" }] }
ExpressionResultDescription
${marker.foo}[{"i":1, "str":"bar"}]Returns full array
${marker["foo"]}[{"i":1, "str":"bar"}]Same as above
${size(marker.foo)}1Size of array
${size(marker.foo[0].i)}Errorsize() cannot be used on numbers
${size(marker.foo[0].str)}3size() of "bar"
${marker.foo.substring(1)}Errorsubstring() on array not allowed
${marker.foo[0].substring(1)}Errorsubstring() on object not allowed
${marker.foo[0].i.substring(1)}Errorsubstring() on number not allowed
${marker.foo[0].str.substring(1)}arSlices from index 1 to end
${marker.foo[0].str.substring(1, size(marker.foo[0].str)-1)}aSlices from index 1 to one before last
value
marker: [{ "value": "123" }]
ExpressionResultDescription
${marker[0]}{"value": "123"}Returns the first object
${marker[0].value}123Accesses value field
${marker.value}ErrorCannot access value directly from array

If Step

Using expressions on values that are not strings or objects can cause errors.

value
user: {"name": "alice","age": 27,"info": {"nickname": "ally"}}
ExpressionResultDescription
${user} = ${user}TrueCompares if both user objects are equal
${user.name} ~= ^a.*TrueChecks if user.name starts with "a"
${user.age} ~= ^[0-9]+$TrueChecks if user.age is a number using regex
${user.info} ~= .*nickname.*Trueuser.info is treated as string and matched by keyword
${size(user.name)} ~= ^[0-9]+$TrueChecks if length of name is numeric

Run Scenario Step Test and Check Results

  1. 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.
  2. Be sure to save the scenario either before or after the test.

Warning
  • 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.
  1. 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.


How to Use the Service

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.