0
votes

I have some alarms to check when an instance is left idle. The conditions are when 12 consecutive datapoints (at 5 min each) are found to have an average of <1% CPU usage, the instance should be stopped and a notification email sent out.

The alarm I created reads:

Whenever _Average_ of _CPU Utilization_
is _<_ +1+ Percent
For at least _12_ consecutive periods of _5 minutes_

Alarm

The alarm gets triggered in the use case of the instance being up and running for 1 hour with <1% CPU usage.

However, the alarm is also triggered when the instance is shut off. For instance, if the the instance is turned on, has 30 minutes of data points <1% CPU, and then is turned off, the alarm will be triggered in 30 minutes.

CPU metrics

How can I set this alarm so it is either:

  1. only triggered when the instance is running, or

  2. only triggered when a full set of 12 consecutive data points is actually collected, and not missing points that register as <1%?

2

2 Answers

2
votes

The answer to this was actually quite simple. If you go to Cloudwatch, select the alarm and scroll down to Additional Configuration. For Missing Data Treatment, select "Treat missing data as good (not breaching alarm)".

1
votes

Well as AWS says:

For each alarm you can specify CloudWatch to treat missing data points as any of the following :

  • missing: the alarm does not consider missing data points when evaluating whether to change state (default)
  • notBreaching: missing data points are treated as begin within the threshold
  • breaching: missing data points are treated as breaching the threshold
  • ignore: the current alarm state is maintained