Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cloudwatch Heartbeat Alarm

I have an app that puts a custom Cloudwatch metric to AWS every minute. This is supposed to act as a heartbeat so I know the app is alive.

Now I want to put an alarm on this metric to notify me if the heartbeat stops. I have tried to accomplish this using different cloudwatch alarm statistics including "average" and "data samples" and setting an alarm threshold less than 1 over a given period. However, in all cases, if my app dies and stops reporting the heartbeat, the alarm will only go into an "Insufficient Data" state and never into an "Alarm" state.

I understand I can put a notification on the "Insufficient Data" state, but I want this to show up as an alarm. Is this possible in Cloudwatch?

Thanks,

Matt

like image 727
Levitron Avatar asked Jul 22 '15 20:07

Levitron


2 Answers

Treat missing data as breaching threshold (step 4)

Check this: https://cloudonaut.io/dead-mans-switch-with-cloudwatch/

enter image description here

like image 129
Daniel B Avatar answered Nov 16 '22 01:11

Daniel B


I think that the alarm going into "Insufficient Data" state has to do with how missing data is being handled. As the doc states:

Similar to how each alarm is always in one of three states, each specific data point reported to CloudWatch falls under one of three categories:

  • Not breaching (within the threshold)
  • Breaching (violating the threshold)
  • Missing

You can specify how alarms handle missing data points. Choose whether to treat missing data points as:

  • missing (The alarm looks back farther in time to find additional data points)
  • notBreaching (Treated as a data point that is within the threshold)
  • breaching (Treated as a data point that is breaching the threshold)
  • ignore (The current alarm state is maintained)

The default behavior is missing.

So i guess that specifying missing data points as breaching would do the trick :)

like image 36
Laureano Ceschini Avatar answered Nov 16 '22 03:11

Laureano Ceschini