aws / amazon-ssm-agent

An agent to enable remote management of your EC2 instances, on-premises servers, or virtual machines (VMs).
https://aws.amazon.com/systems-manager/
Apache License 2.0
1.06k stars 322 forks source link

amazon-cloudwatch-agent-ctl.ps1 - Specifying multiple namespaces? #305

Open TheSwede86 opened 4 years ago

TheSwede86 commented 4 years ago

Steps to reproduce: Start CWA with a certain config with a custom namespace specified in the json-config on a Windows EC2-host: & "C:\Program Files\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1" -a fetch-config -m ec2 -s -c file:C:\temp\cw_default.json ^ Ex. a baseline config for all servers

Append that config with another config and declare "namespace" again to another custom namespace; & "C:\Program Files\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1" -a append-config -m ec2 -s -c file:C:\temp\cw_app.json ^ Ex. a server-specific config ("app","db" etc.)

Send all metrics specified in "default" to one namespace and the ones in "app" to another namespace returns this;

2020/08/27 15:46:31 Failed to merge multiple json config files.
2020/08/27 15:46:31 Under path : /metrics/namespace | Error : Different values are specified for namespace
2020/08/27 15:46:31 I! AmazonCloudWatchAgent Version 1.229438.0.
2020/08/27 15:46:31 Configuration validation first phase failed. Agent version: 1.229438.0. Verify the JSON input is only using features supported by this version.

Since the memory metrics needs to be published in the "CWAgent" namespace for AWS Compute Optimizer to work (see link below) then you need to send all your metrics to "CWAgent" or select to don't use AWS Compute Optimizer (with memory support so it also takes memory utilization into account when doing recommendations)? Or is defining multiple namespaces supported and I botched something :D

Link: https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html

Trying to find a changelog for CloudWatch (the agent) but haven't had much luck in order to see if it solves itself by updating CWA (will try that regardless of course).

Best Regards / TheSwede86

Update: SSM: 2.3.1644.0 > 2.3.1644.0 ^ No new version available

CWA: 1.229438.0 > 1.246396.0 ^ Still same error / issue when trying to send metrics to different namespaces