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.
- Estimated time: 30 minutes
- Recommended OS: macOS, Ubuntu, CentOS
- Region: kr-central-1, kr-central-2
Prework
-
You will need an access key and a VM access key pair to proceed with this tutorial.
-
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.
-
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}cautionA "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 …
-
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 Rule Protocol Packet Source (CIDR) Port Number web/app inbound policy TCP {bastion private ip}/32
22 -
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 -
Once you have accessed the host, change the instance timezone and download the monitoring agent.
- CentOS
- Ubuntu
# 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# Change instance time zone
sudo timedatectl set-timezone Asia/Seoul
# Download monitoring agent
wget ${Object Storage endpoint}/v1/52867b7dc99d45fb808b5bc874cb5b79/kic-monitoring-agent/package/kic_monitor_agent_1.0.0_amd64.deb
sudo dpkg -i kic_monitor_agent_1.0.0_amd64.debRegion Object Storage endpoint kr-central-1 https://objectstorage.kr-central-1.kakaocloud.com
kr-central-2 https://objectstorage.kr-central-2.kakaocloud.com
cautionIf 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 -
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
EOFRegion Monitoring endpoint kr-central-1 https://lma.kr-central-1.kakaoi.io
kr-central-2 https://monitoring.kr-central-2.kakaocloud.com
-
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.
-
Go to KakaoCloud Console > Management > Monitoring.
-
In the default dashboard, select [Beyond Compute Service].
-
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.
-
Go to KakaoCloud Console > Management > Alert Center > Notification Channels.
-
Click the [Create notification channel] button.
-
Enter the information for the channel, choose the channel type, and click [Create].
Type Description Basic Channel Sends notifications via email, SMS, or KakaoTalk Slack/Webhook Sends notifications to the desired Slack channel
Step 4. Integrate Slack notification channel using Webhook
-
In the Slack application, navigate to the Apps tab and click the [Add] button under Incoming WebHooks.
-
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.
Create Webhook-Slack notification channel
-
Copy the generated WebHook URL.
-
Go to KakaoCloud Console > Management > Alert Center > Notification Channels > Create Notification Channel and paste the copied WebHook URL.
-
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.
-
Go to Management > Alert Center > Notification channel, then click the [Create alert policy] button.
-
Set the necessary alert conditions.
-
Select the channel to receive the alert. You can either choose an existing channel or create a new one.
-
Set the alert policy name, review the settings, and click the [Create] button to finalize the alert policy.
-
Ensure that alerts are properly sent to the designated channels when the metric conditions are met.