Skip to main content

API Server Monitoring with Monitoring Flow

This document describes the process of monitoring an API server instance using the Kakao Cloud Monitoring Flow service.

info
  • Estimated Time: 20 minutes
  • User Environment:
    • Recommended Operating System: Ubuntu
    • Region: kr-central-2
  • Prerequisites:

Scenario Overview

This scenario explains how to use the Monitoring Flow service to monitor a VM instance used as an API server. The key steps are as follows:

  • Create an API server instance using Kakao Cloud's Virtual Machine service.
  • Create a Flow Connection to connect the subnet channel where the API server resides.
  • Create a Scenario in Monitoring Flow to monitor the API server.
  • Integrate with Alert Center to receive notifications based on the scenario results.

Prerequisites

1. Network environment setup

To allow communication between the Monitoring Flow service and the VM instance used as the API server, configure the network environment. Refer to the table below to create a VPC and a public subnet.

VPC and Subnet: tutorial
  1. Go to Kakao Cloud Console > Beyond Networking Service > VPC.

  2. Click the [+ Create VPC] button and configure the VPC and subnet as follows:

    CategoryItemSettings/Values
    VPC InformationVPC Nametutorial
    VPC IP CIDR Block10.0.0.0/16
    Availability ZoneNumber of Availability Zones1
    First AZkr-central-2-a
    Subnet SettingsPublic Subnet per Availability Zone1
    kr-central-2-a

    Public Subnet IPv4 CIDR Block: 10.0.0.0/20

  3. Review the topology generated at the bottom and click [Create] if everything is correct.

    • The status of the subnet changes from Pending Create > Pending Update > Active. You must wait until it becomes Active before proceeding to the next step.

2. Configure Security Group

Enhance security by opening specific ports (e.g., TCP 80) in the inbound policy of the security group and restricting access by source IP. This ensures that Monitoring Flow can transmit traffic to the API server according to the specified policy.

Security Group: monitoring-flow-security-group
  1. Go to Kakao Cloud Console > VPC > Security Groups and create a security group as shown below.

    NameDescription (Optional)
    monitoring-flow-security-groupMonitoring Flow tutorial
  2. Click the [+ Add] button and configure the inbound policy as follows, then click [Apply]:

    Inbound Policy to AddItemSettings
    inbound policy 1ProtocolTCP
    Source IP10.0.0.0/24
    Port Number80
    Description (Optional)inbound policy 1

Workflow

This section provides step-by-step instructions for monitoring an API server instance based on a Virtual Machine using Monitoring Flow.

Step 1. Create a VM Instance

Create a VM instance to be used as the API server. Refer to the Create Instance document for instructions.

  1. Go to Kakao Cloud Console > Beyond Compute Service > Virtual Machine > Instances.

  2. Click Create Instance and enter the required information during the instance creation process.

  3. In the Network section, select the VPC and subnet that will connect to Monitoring Flow.

    • Note: The instance must be created within a VPC registered with the security group.
  4. Click Advanced Settings and enter the following script before clicking [Create]:

    #!/bin/bash
    sudo apt update -y
    sudo apt install -y nginx
    sudo service start nginx
  5. Verify the information for the created instance.

    • When the instance status shows as Active, the API server is ready to function normally.
    • Private IP is required for the scenario setup in Monitoring Flow.

    Image Instance List

Step 2. Create a Flow Connection

Create a flow connection to allow access to the VPC and subnet where the VM instance is located.

  1. Go to Kakao Cloud Console > Management > Monitoring Flow > Flow Connections.

  2. Click the [Create Flow Connection] button to go to the creation screen.

  3. In the VPC Selection section, choose the active VPC registered with the security group.

  4. From the subnets connected to the VPC, select the subnet to connect with the flow connection.

    Image Create Flow Connection

Step 3. Create a Scenario

Create a scenario to monitor the status of the VM instance in Monitoring Flow and set the execution schedule.

  1. Go to Kakao Cloud Console > Management > Monitoring Flow > Scenarios.

  2. Click the [Create Scenario] button to go to the creation screen.

  3. Select the Use KakaoCloud VPC option to configure access to Kakao Cloud's internal resources.

  4. Choose one of the registered flow connections.

  5. Set the execution schedule for the scenario.

    Image Create Scenario

Step 4. Add Scenario Step: API

Compose the scenario by adding several steps. In this example, we add an API step to check the status of the API server.

  1. Go to Kakao Cloud Console > Management > Monitoring Flow > Scenarios.

  2. Click the name of the scenario you created in the Scenarios menu.

  3. In the Details tab, click [Add Scenario Step].

  4. In the right panel, select API as the step type.

  5. Fill out the fields as follows:

    ItemExampleDescription
    TypeAPISelect API
    Step NameAPI-1Step Name
    Expected Code200The server should return a 200 status code if it is functioning correctly, indicating availability
    MethodGETUse HTTP GET to check the API server's status
    URLhttp://{Private-IP}API access URL (use the private IP of the Virtual Machine instance)

    Image Add API Step

Step 5. Test the Scenario

Check the test execution result of the scenario you created. If a 200 response is returned from the URL configured in Step 4, it indicates that the API server is functioning correctly. If an unexpected response code is returned, it indicates an issue with the server status, and you can use it to diagnose the error.

  1. If the test executes successfully, you will see Success under the [Execution Results] section. Image Test Success Result

  2. If a response code different from the expected one is returned, it will be marked as Failure, indicating a potential issue with the server status. At this point, check the error details in the lower right panel to resolve the problem.

    Image Test Failure Result

    caution
    • A call failure error may occur if you access a deactivated instance. Ensure that the correct IP address is entered.
  3. After closing the test screen, save the scenario on the Scenario Step Edit screen. The saved scenario will automatically run according to the configured schedule.

Step 6. Check Execution Results

Check the execution results and times of the scenario to evaluate whether it is functioning correctly. You can verify if the scenario completed without errors through detailed information.

  1. In the Kakao Cloud Console, select Management > Monitoring Flow > Scenarios.

  2. Choose the scenario you want to check, and click on the Execution Results tab in the detailed view.

    Image Scenario Execution Results List

  3. In the execution results list, click on an event to view the detailed results.

    Image Detailed Scenario Execution Results

Step 7. Create Alert Center Notification Policy

Set an Alert Center notification policy to receive notifications based on the execution results of Monitoring Flow. The example below shows how to configure metric conditions to receive alerts based on the success/failure status of the scenario.

  1. In the Kakao Cloud Console, select Management > Alert Center > Notification Policy. For more details, refer to the Notification Policy Creation document.

  2. Refer to the table below to set the notification conditions.

    ItemConfiguration Details
    Condition TypeMetric
    ServiceMonitoring Flow
    Condition SetupSet the metric items to receive success/failure alerts
    - Set Scenario Success Count and Scenario Fail Count for the scenario to receive all metric alerts
    - If you only want to receive alerts on failures, set only Scenario Fail Count
    Resource ItemSelect the scenario you want to receive alerts for
    Threshold1 count or more
    Duration1 minute
  3. Click the [Next] button at the bottom to complete the creation of the notification policy.

    Image Create Notification Policy

  4. Based on the notification policy you set, you will receive real-time notifications about the execution results (success or failure) of the Monitoring Flow scenario. This helps you quickly detect and respond to system status changes.