'Datadog check for autoscaling group

Iam in the process of writing a datadog check to trigger an alert for autoscaling groups when the number of running instances reaches the maximum value set in the auto scaling group.

This is pretty straightforward as I have done here

avg:aws.autoscaling.group_max_size by {autoscaling_group} - avg:aws.autoscaling.group_desired_capacity by {autoscaling_group} == 0

The problem that Iam facing is that this alert should only be triggered if the max value and min value are not equal.

I have trouble integrating this to the query..does anyone have any advice on how to integrate this to the query that ive written



Solution 1:[1]

I did something similar by taking the number of in service instances and the max size, the setting a warning and alert threshold.

I noticed the query above didn't include a region after the autoscaling properties, either as a wildcard or explicitly written out. Maybe adding a {*} as below will help.

The metric queries are:

sum:aws.autoscaling.group_in_service_instances{*} by {autoscaling_group}
sum:aws.autoscaling.group_max_size{*} by {autoscaling_group}
a / b * 100 

or

sum:aws.autoscaling.group_in_service_instances{region:us-east-1} by {autoscaling_group} / sum:aws.autoscaling.group_max_size{region:us-east-1} by {autoscaling_group} * 100

I then have a threshold limit of 90% to send a warning message, and 100% to send an alarm that it's maxed out.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 xxkazunarixx