Cloudwatch Metric Configuration JSON

Reading Time: 2 minutes

CloudWatch20dashboard

Deploying Configuration .json to Instance

To deploy this configuration file and make the Cloudwatch Agent read it which we installed via Ansible by this post, you need to be sure that you installed Cloudwatch Agent to your instance properly. After installing the agent, you need to put this configuration file under /opt/aws/amazon-cloudwatch-agent/etc directory and make sure you name it amazon-cloudwatch-agent.json.

When you start the agent after putting your configuration file, Cloudwatch service will automatically turn it into a .toml file under the same directory and reads that file.

If your agent refuse to start when you run this:

Make sure you don’t have any syntax errors in metric configuration or common-config.toml where you put your proxies.

X-RAY ME!

This configuration file will only retrieve metric data(CPU Usage, Ram Usage, Free Storage, Network Usage etc.). Which is really, REALLY useful when you want to monitor your instances so that you can see if something goes wrong. You can even initialise alarms to warn you when something goes over the threshold which I am going to investigate in another post.

If you want the documentation of these metrics and their attributes check this: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html. It also feels so good when you monitor your instances through the dashboard. It’s like watching your child riding on a swing 🙂

Let’s get right into it!

2 thoughts on “Cloudwatch Metric Configuration JSON

  1. Rohan Pathak January 9, 2019 / 12:18 am

    I configure my cloudwatch using config wizard, and I put the config.json in the above mentioned directory, but its weird everytime I restart agent, agent creates its own file with name amazon-cloudwatch-agent.json and a .toml with only mem and swap metrics and uses this file, and I see only these 2 metrics on my CW dashboard.

    • Hmerac January 10, 2019 / 9:15 am

      Hello Rohan,

      Sorry for the late response.

      Can you try naming our config file as amazon-cloudwatch-agent.json and restarting it?

Leave a Reply