Search code examples
amazon-web-servicesamazon-emramazon-cloudwatch

CloudWatch: some metrics takes count for all time, not for period


I configured AWS::CloudWatch::Alarm that is triggered by YARN application failure. Than message is send to Slack (Alarm->SNS->Lambda->Slack).

The issue is that AWS/EMR, AppsFailed metric returns count of fails for the whole history, no matter which period you will choose. Means after the first failure count will be always >=1:

example

Is this an expected behaviour? How can I trigger alert only when count has been increased compared to previous value?

From AWS docummentation:

AppsFailed: The number of applications submitted to YARN that have failed to complete.


Solution

  • You can use the new Alarms on Metric math functionality and the "RATE" function See documentation

    Returns the rate of change of the metric, per second. This is calculated as the difference between the latest data point value and the previous data point value, divided by the time difference in seconds between the two values.