Skip to content

Attempting to use CloudWatch monitoring to track down a memory issue

0

I recently posted a question regarding a Lightsail instance that hosts my Wordpress site.

https://repost.aws/questions/QUPz6FP8DxSBOHlkXttlgU0g#ANBGET2dLvRzuAIL_QKLSOxQ

I then attempted to install cloud watch using this guide but could not get it to start. I've probably done something wrong. https://aws.amazon.com/blogs/compute/monitoring-memory-usage-lightsail-instance/

I then decided to export a snapshot to an EC2 instance since it looked easier to set up the monitoring. While doing so it seems I can't get the SSM Agent to validate. I'm not sure if it's a security/connection issue or if I've misconfigured something. It could also be because this was originally a Lightsail instance that is now and EC2 instance and it just may not work as expected. Guide I'm following here: https://www.youtube.com/watch?v=hqGnDzCIMBg

Any guidance would be appreciated. I'd like to get the memory monitoring set up so than I can m make the appropriate decision on whether to go from a 1 GB RAM, 2 vCPUs, 40 GB SSD to one with more RAM or if it's a problem with something else on my instance.

asked 2 years ago894 views
3 Answers
1

Hello.

I then attempted to install cloud watch using this guide but could not get it to start. I've probably done something wrong.
https://aws.amazon.com/blogs/compute/monitoring-memory-usage-lightsail-instance/

What kind of error was output when starting CloudWatch Agent?
Basically, you should be able to use it if the OS is compatible with CloudWatch Agent.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html

CloudWatch Agent errors should be output to the log file.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/troubleshooting-CloudWatch-Agent.html#CloudWatch-Agent-files-and-locations

I then decided to export a snapshot to an EC2 instance since it looked easier to set up the monitoring. While doing so it seems I can't get the SSM Agent to validate. I'm not sure if it's a security/connection issue or if I've misconfigured something. It could also be because this was originally a Lightsail instance that is now and EC2 instance and it just may not work as expected. Guide I'm following here: https://www.youtube.com/watch?v=hqGnDzCIMBg

Is SSM Agent installed on EC2?
I checked the YouTube video you shared, and it doesn't include the steps to install SSM Agent, so if you don't have it installed, you'll need to install it first.
https://docs.aws.amazon.com/systems-manager/latest/userguide/manually-install-ssm-agent-linux.html

EXPERT
answered a year ago
EXPERT
reviewed a year ago
EXPERT
reviewed a year ago
0

https://repost.aws/knowledge-center/lightsail-monitor-with-cloudwatch talk about how to use CloudWatch agent to monitor Lightsail memory metrics using CLI.

Further, if you can't see the metrics on the CloudWatch console, then check the log file at /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log for authentication or credential errors. For more information, see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/troubleshooting-CloudWatch-Agent.html#CloudWatch-Agent-troubleshooting-cannot-start

AWS
answered a year ago
EXPERT
reviewed a year ago
0

Hi Everyone,

Thanks for the responses. When attempting to start the CloudWatchAgent on the problematic Lightsail instance I get this console output:

bitnami@ip-<private ip>:/opt/aws/amazon-cloudwatch-agent/etc$ sudo amazon-cloudwatch-agent-ctl -c file:/opt/aws/amazon-cloudwatch-agent//bin/config.json -a fetch-config -s ****** processing amazon-cloudwatch-agent ****** I! Trying to detect region from ec2 D! [EC2] Found active network interface I! imds retry client will retry 1 timesSuccessfully fetched the config and saved in /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/file_c onfig.json.tmp Start configuration validation... 2024/09/13 15:30:45 Reading json config file path: /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d/file_config.json.tmp ... 2024/09/13 15:30:45 unable to scan config dir /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.d with error: unable to parse json, error: unexpected end of JSON input 2024/09/13 15:30:45 No json config files found, use the default one 2024/09/13 15:30:45 I! Valid Json input schema. 2024/09/13 15:30:45 D! ec2tagger processor required because append_dimensions is set 2024/09/13 15:30:45 Configuration validation first phase succeeded I! Detecting run_as_user... I! Trying to detect region from ec2 D! [EC2] Found active network interface I! imds retry client will retry 1 times /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent -schematest -config /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml Configuration validation second phase succeeded Configuration validation succeeded amazon-cloudwatch-agent has already been stopped bitnami@ip-172-26-9-244:/opt/aws/amazon-cloudwatch-agent/etc$ sudo amazon-cloudwatch-agent-ctl -a status { "status": "stopped", "starttime": "", "configstatus": "configured", "version": "1.300043.0b781" }

And this is what's in the log file:

/opt/aws/amazon-cloudwatch-agent/logs$ cat amazon-cloudwatch-agent.log 2024/09/04 03:47:33 I! Return exit error: exit code=99 2024/09/04 03:47:33 I! No json config files found, please provide config, exit now 2024/09/04 19:44:33 I! Return exit error: exit code=99 2024/09/04 19:44:33 I! No json config files found, please provide config, exit now 2024/09/06 18:34:20 I! Return exit error: exit code=99 2024/09/06 18:34:20 I! No json config files found, please provide config, exit now 2024/09/09 12:59:38 I! Return exit error: exit code=99 2024/09/09 12:59:38 I! No json config files found, please provide config, exit now 2024/09/11 20:56:29 I! Return exit error: exit code=99 2024/09/11 20:56:29 I! No json config files found, please provide config, exit now 2024/09/13 15:30:48 I! Return exit error: exit code=99 2024/09/13 15:30:48 I! No json config files found, please provide config, exit now

As far as I can tell, I've done everything form this guide correctly. https://aws.amazon.com/blogs/compute/monitoring-memory-usage-lightsail-instance/

My fear is that as part of the initial setup I may have done something wrong on the instance. The other thing I'm thinking while I double check things is that I may not have configured my IAM user correctly but I can't figure out how to verify and change it.

It was my understanding that the video I was using for the EC2 instance would install the SSM Agent during the process. That it was s simplified way to get there instead of installing and configuring through the CLI.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.