CloudWatch Custom-Metrics with multiple namespace

1

Hello, I'm using EC2 instance and I want to collect memory-usage and disk-usage. So what I did is installed Cloud-Watch-Agent so that I can set Cutom-metrics. Now I can collect both of them with 1 namespace. But the thing is, is it possible to seperate the namespace to check memory-usage and disk-usage individually? and if so, how should I set up on json file?

For example, as you can see the file below, I want to seperate just the namespace with single EC2 instance. But is there a better way to write it? it seems like the file below doesn't work properly.

I "metrics": {
		"namespace": "memory",
		"append_dimensions": {
			"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
			"ImageId": "${aws:ImageId}",
			"InstanceId": "${aws:InstanceId}",
			"InstanceType": "${aws:InstanceType}"
		},
		"metrics_collected": {
			"Memory": {
				"measurement": [
					"% Committed Bytes In Use"
				],
				"metrics_collection_interval": 60
			},
			
		}
"metrics_collected": {
"LogicalDisk": {
				"measurement": [
					"% Free Space"
				],
				"resources": [
					"*"
				],
				"metrics_collection_interval": 60
			}
		}
	}
}


질문됨 2년 전1073회 조회
1개 답변
0

Hello, thanks for reaching out!

Unfortunately it's not possible at this time to configure multiple namespace destinations within a CloudWatch Agent metrics configuration, even when appending multiple config files with separate namespaces in the metrics sections.

There is a feature request in place for this ability, however, I'm unable to give an ETA on when this feature might be implemented for the CloudWatch Agent. You can keep an eye on the AWS What's New page for updates.

For the time being, the metrics from an Agent configuration will all have to utilize the same namespace. For increased ease of tracking these metrics, you do have the option of appending custom dimensions to each metric. Example:

{
	"metrics": {
		"append_dimensions": {
			"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
			"ImageId": "${aws:ImageId}",
			"InstanceId": "${aws:InstanceId}",
			"InstanceType": "${aws:InstanceType}"
		},
		"metrics_collected": {
			"Memory": {
				"measurement": [
					"% Committed Bytes In Use"
				],
				"metrics_collection_interval": 60,
				"append_dimensions": {
					"CustomDimensionName": "MemoryMetric"
				}
			},
			"LogicalDisk": {
				"measurement": [
					"% Free Space"
				],
				"metrics_collection_interval": 60,
				"resources": [
					"*"
				],
				"append_dimensions": {
					"CustomDimensionName": "DiskMetric"
				}
			}
		}
	}
}
AWS
지원 엔지니어
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠