Skip to main content

Setting up Real-Time Alerts with Alert Center

This guide explains how to set up metric, log, and event-based alerts in KakaoCloud's Alert Center.

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

Before you start

KakaoCloud's Alert Center allows you to configure alert policies and notification channels to receive alerts for service events and resource failures. Setting up timely notifications helps you detect and resolve issues quickly.

About this scenario

This tutorial provides step-by-step instructions for configuring metric, log, and event-based alerts in Alert Center, allowing you to receive real-time notifications.

  • Notification channel setup: Create and configure channels to receive alerts in Alert Center.
  • Metric-based alerts: Set up alerts by simulating a CPU load test.
  • Log-based alerts: Create a log-based alert by generating error logs.
  • Event-based alerts: Set up an event-based alert triggered by instance restarts.

Prework

1. Install monitoring agent

To monitor compute resources on your instance, you must install a monitoring agent. For detailed instructions, refer to the BCS Instance Monitoring tutorial.

2. Enter contact information

Ensure you have entered your email address and phone number correctly to receive alerts. For setup instructions, refer to the Modify account information guide.

3. Create notification channels in Alert Center

In KakaoCloud's Alert Center, you can Create notification channels to receive alerts for compute resource risk levels.

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

  2. Click the [Create notification channel] button.

  3. In the notification channel creation tab, enter the required information, select the channel type, and click [Create].

    TypeDescription
    DefaultSends alerts via email/SMS/KakaoTalk
    Slack/WebhookSends alerts to a specified Slack channel or webhook
info
  • The log file path for the monitoring agent used in this tutorial is /var/log/messages, and the notification channel type is Default (email).

Procedures

The following instructions explain how to configure various alert types (metric, log, event) in Alert Center.

1. Metric-based alert

Perform a CPU load test (stress) on an instance with the monitoring agent installed to confirm the metric-based alert.

Step 1. Create alert policy

Use KakaoCloud's Alert Center to configure alert policies based on compute resource risk levels.

  1. In Alert Center > Notification Channel, click [Create alert policy].

  2. Set the necessary alert conditions and click [Create].

    ItemValue
    Condition typeMetric
    ServiceBeyond Compute Service
    Condition- Metric: CPU usage
    - Resource: instance (select monitoring instance)
    - Threshold: over 70%
    - Duration: 1 minute
    - Severity: Critical
    Notification ChannelSelect the preconfigured notification channel
    Alert policy nametutorial-alert-metric
    EnabledYes

Step 2. Test CPU load and confirm alert

On the instance with the monitoring agent installed, use the stress tool to generate CPU load and verify the alert is received.

  1. SSH into the instance with the monitoring agent installed.

  2. Install the stress tool.

    sudo apt-get update
    sudo apt-get install stress
  3. Generate CPU load for 2 minutes.

    stress --cpu 2 --timeout 2m

    stress: info: [2221] dispatching hogs: 2 cpu, 0 io, 0 vm, 0 hdd # Pausing for 2 minutes is expected behavior
    stress: info: [2221] successful run completed in 120s # Output after 2 minutes
  4. Confirm that the metric-based alert for CPU load was sent to the registered email address from KakaoCloud.

    Check Alert Check Alert


2. Log-based alert

This section explains how to set up a log-based alert triggered by the occurrence of error messages in the log files of an instance with the monitoring agent installed.

Step 1. Create alert policy

You can configure log-based alert policies in KakaoCloud's Alert Center.

  1. In Alert Center > Notification Channel, click [Create alert policy].

  2. Set the necessary alert conditions and click [Create].

    ItemValue
    Condition typeLog
    ServiceBeyond Compute Service
    Condition- Keyword: error
    ⚠️ After entering the keyword, click + to add it.
    Notification ChannelSelect the preconfigured notification channel
    Alert policy nametutorial-alert-log
    EnabledYes

Step 2. Check error alert

Run a test script on the instance with the monitoring agent installed to verify the log-based alert.

  1. SSH into the instance with the monitoring agent installed.

  2. Create and run the error test script.

    # Create script file
    touch script.sh

    # Open the file
    sudo vi script.sh

    Enter the following script in script.sh and save it.

    script.sh
    #!/bin/bash

    # Log file path set during monitoring agent installation
    log_file="/var/log/messages"

    echo "Error: Something went wrong" >&2

    # Write to log file with administrator privileges
    sudo bash -c "echo $(date): Custom error occurred >> $log_file"

    Grant execute permissions and run the script.

    # Grant execute permissions to the script
    sudo chmod +x script.sh

    # Run the script
    ./script.sh

    # Output when the script is executed
    Error: Something went wrong
  3. Confirm that the log-based alert for the error keyword was sent to the registered email address from KakaoCloud.

    Check Alert Check Alert


3. Event-based alert

This section explains how to set up an event-based alert triggered by instance restart events in KakaoCloud's Alert Center.

Step 1. Create alert policy

You can configure event-based alert policies in KakaoCloud's Alert Center.

  1. In Alert Center > Notification Channel, click [Create alert policy].

  2. Set the necessary alert conditions and click [Create].

    ItemValue
    Condition typeEvent
    ServiceVirtual Machine
    Condition- Event: Instance Restart
    Notification ChannelSelect the preconfigured notification channel
    Alert policy nametutorial-alert-event
    EnabledYes

Restart the virtual machine instance and verify that the event-based alert was sent.

Check Alert Check Alert