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.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF