Skip to main content

Monitoring BCS instance

You can monitor the computing resources of VMs in your project through the Monitoring Agent. This guide provides an example of installing the Monitoring Agent on each instance and monitoring a specific instance.

Basic information
  • Estimated time: 30 minutes
  • Recommended OS: macOS, Ubuntu, CentOS
  • Region: kr-central-1, kr-central-2

Prework

  1. You will need an access key and a VM access key pair to proceed with this tutorial.

  2. This tutorial is based on a 3-Tier web service environment. Before starting the tutorial, set up the necessary environment using one of the appropriate hands-on examples.

Step 1. Install monitoring agent

The Monitoring Agent allows you to set metric and log-based policies to monitor the state and changes of computing resources in KakaoCloud instances. For details, refer to the Install monitoring agent.

  1. Run the terminal in your local environment and execute the following command to initiate an SSH connection.

    chmod 400 ${PRIVATE_KEY}
    ssh -i ${PRIVATE_KEY}.pem ubuntu@${BASTION_PUBLIC_IP}
    caution

    A "bad permissions" error may occur due to key file permission issues. In such cases, use the sudo command to resolve the issue.
    Example: sudo ssh …

  2. Traffic to internal hosts is relayed through the Bastion. Ensure that the WEB and WAS hosts can receive traffic from the Bastion by checking the security group in the KakaoCloud console. Verify that the following inbound rule is present or add it if necessary.

    Inbound RuleProtocolPacket Source (CIDR)Port Number
    web/app inbound policyTCP{bastion private ip}/3222
  3. Use SSH to connect to each host.

    # web1
    ssh -i ${PRIVATE_KEY}.pem ubuntu@${BASTION_PUBLIC_IP} -p 10000

    # web2
    ssh -i ${PRIVATE_KEY}.pem ubuntu@${BASTION_PUBLIC_IP} -p 10001

    # app1
    ssh -i ${PRIVATE_KEY}.pem ubuntu@${BASTION_PUBLIC_IP} -p 10002

    # app2
    ssh -i ${PRIVATE_KEY}.pem ubuntu@${BASTION_PUBLIC_IP} -p 10003
  4. Once you have accessed the host, change the instance timezone and download the monitoring agent.

    # Change instance time zone
    sudo timedatectl set-timezone Asia/Seoul

    # Download monitoring agent
    sudo yum localinstall ${Object Storage endpoint}/v1/52867b7dc99d45fb808b5bc874cb5b79/kic-monitoring-agent/package/kic_monitor_agent-1.0.0.x86_64.rpm
    RegionObject Storage endpoint
    kr-central-1https://objectstorage.kr-central-1.kakaocloud.com
    kr-central-2https://objectstorage.kr-central-2.kakaocloud.com
    caution

    If a dpkg/lock error occurs, run the following script commands.

    # Delete cache files related to /var/lib/dpkg/lock
    sudo rm /var/lib/apt/lists/lock
    sudo rm /var/cache/apt/archives/lock
    sudo rm /var/lib/dpkg/lock*
    sudo dpkg --configure -a
    sudo apt update
  5. Modify the configuration file of the monitoring agent.

    # Enter access key information and log file path in the configuration file
    cat <<EOF | sudo tee /etc/default/kic_monitor_agent

    KIC_MONITOR_ENDPOINT_URL=${Monitoring endpoint}
    KIC_MONITOR_AGENT_AUTH_APPLICATION_CREDENTIAL_ID="${Access key ID}"
    KIC_MONITOR_AGENT_AUTH_APPLICATION_CREDENTIAL_SECRET="${Secret access key}"

    KIC_LOG_FILE_PATH="{Log file path}"

    ## If the host cannot directly access the public network, you can specify an HTTP proxy server.
    # HTTP_PROXY=http://proxy
    # HTTPS_PROXY=https://proxy
    # NO_PROXY=169.254.169.254
    EOF
    RegionMonitoring endpoint
    kr-central-1https://lma.kr-central-1.kakaoi.io
    kr-central-2https://monitoring.kr-central-2.kakaocloud.com
  6. Restart the monitoring agent and verify it is running.

    # Restart the agent
    sudo systemctl restart kic_monitor_agent

    # Enable the agent to start automatically on VM boot
    sudo systemctl enable kic_monitor_agent

    # Verify the agent is running
    sudo journalctl -u kic_monitor_agent -f

    모니터링 에이전트 실행 확인

Step 2. Check monitoring information

Once the monitoring agent is installed on the instance, you can view the monitoring graphs for the instance's computing resources.

  1. Go to KakaoCloud Console > Management > Monitoring.

  2. In the default dashboard, select [Beyond Compute Service].

  3. Choose the instance to monitor and review the monitoring graphs.

    모니터링 그래프 예시

Step 3. Create notification channel in Alert Center

In KakaoCloud's Alert Center, you can create notification channels for alerts about computing resource risk levels.

  1. Go to KakaoCloud Console > Management > Alert Center > Notification Channels.

  2. Click the [Create notification channel] button.

  3. Enter the information for the channel, choose the channel type, and click [Create].

    TypeDescription
    Basic ChannelSends notifications via email, SMS, or KakaoTalk
    Slack/WebhookSends notifications to the desired Slack channel

Step 4. Integrate Slack notification channel using Webhook

  1. In the Slack application, navigate to the Apps tab and click the [Add] button under Incoming WebHooks.

    Slack에서 Incoming WebHooks 추가

  2. Click the [Add to Slack] button and select the channel where you want to receive notifications. Once the channel selection is complete, click the [Add Incoming WebHook Integration] button.

    Adding Incoming WebHooks in Slack Create Webhook-Slack notification channel

  3. Copy the generated WebHook URL.

  4. Go to KakaoCloud Console > Management > Alert Center > Notification Channels > Create Notification Channel and paste the copied WebHook URL.

    Creating a Webhook-Slack notification channel

  5. Verify the created notification channel.

    생성된 수신 채널 확인

Step 5. Create alert policy

In KakaoCloud's Alert Center, you can set up alert policies based on the risk levels of your computing resources.

  1. Go to Management > Alert Center > Notification channel, then click the [Create alert policy] button.

  2. Set the necessary alert conditions.

    Example Condition settings

  3. Select the channel to receive the alert. You can either choose an existing channel or create a new one.

  4. Set the alert policy name, review the settings, and click the [Create] button to finalize the alert policy.

  5. Ensure that alerts are properly sent to the designated channels when the metric conditions are met.