Cloudwatch Metric query to include both Memory and CPU utilization

0

Hi, We have a CloudWatch custom alarm based on the average memory usage of and autoscaling group containing 2 EC2 instances, with the query being

SELECT AVG(mem_used_percent) FROM SCHEMA(CWAgent, AutoScalingGroupName,ImageId,InstanceId,InstanceType) WHERE AutoScalingGroupName = 'asg_name'

In this query, if usage surpasses 70%, autoscaling is automatically triggered and an additional EC2 instance is added.

Is it possible for me to add the average CPU_utilization >= 70% to this query as well? I tried using the 'UNION' operator, but unfortunately it does not work. Please help.

Note: Autoscaling group name has been changed to 'asg_name' to protect confidentiality.

질문됨 8달 전666회 조회
2개 답변
0

Hi, you cannot mix two different metrics, UNION or apply metric maths on top of a Metrics Insights query. An alternative would be to create 2 distinct alarms, one on the CPU, one on the Mem, and join them using a composite alarm. The drawback is that there is no direct integration between the composite and autoscaling actions, so it may not be as easy to control scale up/down from there as from a metric alarm.

Otherwise as suggested by rePost-User-0046670 you could try to come up with a math expression to define your condition.

profile pictureAWS
Jsc
답변함 7달 전

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

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

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

관련 콘텐츠