Can AWS CloudWatch alarms be paused/disabled during specific hours?

前端 未结 4 891
野趣味
野趣味 2020-12-30 02:15

I want to automatically toggle alarms on/off during specific periods of time so that they do not fire during maintenance windows. I\'m doubting that an easy or direct method

相关标签:
4条回答
  • 2020-12-30 02:51

    Yeah, just as above you can do it using CLI. Also, you can stop sending data from scripts INCASE of custom metrics so that will automatically stop the alarm.

    Another way is you can write a script where you can have defined alarm using put-alarm (CloudWatch CLI ). There could be a function that creates alarms and one that deletes them. Call them when needed.

    0 讨论(0)
  • 2020-12-30 02:54

    I got here while looking for something that would help me to disable alerts for my machine which is performing backups every Saturday between 11:00 and 11:30. The only solution I found is to create cronjob to disable/enable particular alert and run them on particular times:

    59 10 * * 6 ec2-user aws cloudwatch disable-alarm-actions --alarm-names "Alarm-1" "Alarm-2"
    31 11 * * 6 ec2-user aws cloudwatch disable-alarm-actions --alarm-names "Alarm-1" "Alarm-2"
    

    Your node needs to have access to CloudWatch, obviously. I gave it CloudWatchFullAccess.

    0 讨论(0)
  • 2020-12-30 02:54

    Agreed. Felt this pain on "presence of data" alarms over "off hours". I would be looking to leverage AWS Lambda's scheduled CloudWatch triggers which is our new go-to scheduler for actions invoked at a rate less than 1/minute.

    https://docs.aws.amazon.com/lambda/latest/dg/with-scheduled-events.html https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.disable_alarm_actions

    0 讨论(0)
  • 2020-12-30 02:58

    It's not automatic but it can be done:

    http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_EnableAlarmActions.html

    What you want to do is: right before the maintenance window starts you Disable the alarm actions. As the windows ends you Enable the alarm actions.

    0 讨论(0)
提交回复
热议问题