Created
March 12, 2019 14:57
-
-
Save harrietty/3eff4ad503e8d341243080052b23c8de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
NAMESPACE=$1 | |
ALARM_NAME_PREFIX=$2 | |
# Error | |
aws cloudwatch put-metric-alarm \ | |
--alarm-name "$ALARM_NAME_PREFIX Error Count" \ | |
--actions-enabled \ | |
--metric-name error \ | |
--namespace ${NAMESPACE} \ | |
--period 60 \ | |
--evaluation-periods 1 \ | |
--threshold 1 \ | |
--statistic Sum \ | |
--comparison-operator GreaterThanOrEqualToThreshold \ | |
--treat-missing-data notBreaching | |
# Warning | |
aws cloudwatch put-metric-alarm \ | |
--alarm-name "$ALARM_NAME_PREFIX Warning Count" \ | |
--actions-enabled \ | |
--metric-name warning \ | |
--namespace ${NAMESPACE} \ | |
--period 60 \ | |
--evaluation-periods 10 \ | |
--threshold 1 \ | |
--statistic Sum \ | |
--comparison-operator GreaterThanOrEqualToThreshold \ | |
--treat-missing-data notBreaching | |
# Critical | |
aws cloudwatch put-metric-alarm \ | |
--alarm-name "$ALARM_NAME_PREFIX Critical Error Count" \ | |
--actions-enabled \ | |
--metric-name critical \ | |
--namespace ${NAMESPACE} \ | |
--period 60 \ | |
--evaluation-periods 1 \ | |
--threshold 1 \ | |
--statistic Sum \ | |
--comparison-operator GreaterThanOrEqualToThreshold \ | |
--treat-missing-data notBreaching |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment