Bobcares

Status of CloudWatch Agent – Verify, Start & Stop it

by | Jul 29, 2021

Don’t know how to find the Status of CloudWatch Agent? We can help you.

Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.

Today, let us see how to query CloudWatch Agent to find its status.

Status of CloudWatch Agent

Moving ahead, let us discuss different aspects of a CloudWatch Agent.

  • Verify that the CloudWatch agent is running

To do so, we use AWS Systems Manager.

In addition, on the local server, we can use the command line.

  1. We open the Systems Manager console.
  2. Then in the navigation pane, we select Run Command.

-or-

If the AWS Systems Manager home page opens, we select Explore Run Command.

  1. In the Command document list, we select the AmazonCloudWatch-ManageAgent.
  2. In the Action list, we select status.
  3. We select the default for Optional Configuration Source.
  4. We keep Optional Configuration Location blank.
  5. Then in the Target area, we select the instance to check.
  6. Finally, we click, Run.

The output will be like this:

{
“status”: “running”,
“starttime”: “2017-12-12T18:41:18”,
“version”: “1.73.4”
}

On the other hand, to query the status locally via the command line our Support Techs suggest:

On a Linux server:

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status

Then on a Windows Server as an administrator, we run:

& $Env:ProgramFiles\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1 -m ec2 -a status
  • Stop and restart the CloudWatch agent

First, let us stop the agent via Run Command.

  1. To do so, we open the Systems Manager console
  2. In the navigation pane, we select the Run Command.

-or-

Like the above, if the home page opens, we select Explore Run Command.

  1. In the Command document list, we select AmazonCloudWatch-ManageAgent.
  2. Then in the Targets area, we select the instance with the CloudWatch agent.
  3. In the Action list, we select stop.
  4. We keep Optional Configuration Source and Optional Configuration Location blank.
  5. Later we select, Run.

Now, let us stop it locally via the command line.

On a Linux server:

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a stop

On Windows Server:

& $Env:ProgramFiles\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1 -m ec2 -a stop
  • Start the CloudWatch agent using Systems Manager Run Command

Our Support Techs recommend the below steps to start the agent via Run Command:

  1. Open the Systems Manager console.
  2. Then we select the Run Command in the navigation pane.

-or-

In the case of the AWS Systems Manager home page opens, we select Explore Run Command.

  1. In the Command document list, we select AmazonCloudWatch-ManageAgent.
  2. Then we select the instance with the CloudWatch agent in the Targets area.
  3. In the Action list, select configure.
  4. Then in the Optional Configuration Source list, select ssm.
  5. After that, in the Optional Configuration Location box, we enter the name of the agent configuration file that we created and saved.
  6. In the Optional Restart list, we can select yes.
  7. Eventually, we click Run.
  • Start the CloudWatch agent on an Amazon EC2 instance using the command line

To do so, our Support Techs recommend the following:

a) Linux and macOS:

If we save the configuration file in the Systems Manager Parameter Store:

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c ssm:configuration-parameter-store-name

b) Linux and macOS:

On the other hand, if we save the configuration file on the local computer:

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:configuration-file-path

c) Windows Server:

If we save the agent configuration file in Systems Manager Parameter Store:

& “C:\Program Files\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1” -a fetch-config -m ec2 -s -c ssm:configuration-parameter-store-name

d) Windows Server:

Similarly, if we save the agent configuration file on the local computer:

& “C:\Program Files\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1" -a fetch-config -m ec2 -s -c file:configuration-file-path

[Need help with the process? We’d be happy to assist]

Conclusion

In short, we saw how our Support Techs find the status of CloudWatch Agent.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. Richard

    Thankyou very much for this. Very helpful blog for my Linux estate

    Reply
    • Hiba Razak

      Hello Richard,
      Thanks for the feedback.We are glad to know that our article was helpful for you.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.