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.

posta 8 mesi fa668 visualizzazioni
2 Risposte
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
con risposta 7 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande