Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Configuration and use of AWS CloudWatch Agent

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Background introduction

AWS's Cloudwatch can easily monitor all kinds of data, but its disadvantage is that it can only monitor Hypervisor data by default, not client-side OS-level data. In traditional solutions, such as monitoring memory, hard drive usage, or other custom data, we need to write a script and send it to the corresponding Cloudwatch API. This approach is relatively unfriendly, and AWS provides an official solution called Cloudwatch agent (https://docs.aws.amazon.com/zh_cn/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-on-EC2-Instance.html)). After installation, you can use the wizard to generate the corresponding configuration file to achieve the function of handwritten script.

Procedure to configure IAM Role

Let's take a look at how it works. All deployments of Douzi are implemented through SSM, so there is no need to configure them manually. So the first step is to configure IAM Role to ensure that the EC2 instance can access SSM. For specific steps, please see https://blog.51cto.com/beanxyz/2316695.

In addition, we also need permission to install CloudwatchAgent, and permission to access the Parameter Store; of SSM to write the configuration file to Parameter Store, so that we can directly specify this file for configuration when unified push.

After you configure the permissions for IAM Role, remember to assign them to the EC2 instance.

Install CloudWatchAgent

Then go back to SSM and make sure that all EC2 instances have the latest SSM Agent installed in Managed Instances. If not, click Agent auto update to upgrade.

Install CloudWatchAgent uniformly by doing the following in Run Command

Enter the installed Name and Version

Wait for 1 minute to download and install successfully.

Generate configuration file

Next, we need to generate the configuration file.

Open the configuration wizard on a server with CloudwatchAgent installed and choose according to your own needs. At the end of the choice, he will ask whether to save the generated config.json file to parameter store, select yes, and enter a file name.

Generated configuration file

Configure CloudwatchAgent

Next, open Run Command again and select AmazonCloudWatch-ManageAgent

Specify the name of the profile

Perform run operation

View the result

He will automatically generate a namespace called CWAgent in Cloudwatch.

After waiting for a moment, you can check the corresponding memory, CPU, disk and even custom data usage.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report