Skip to content

Instantly share code, notes, and snippets.

@harrietty
Created March 12, 2019 14:57
Show Gist options
  • Save harrietty/3eff4ad503e8d341243080052b23c8de to your computer and use it in GitHub Desktop.
Save harrietty/3eff4ad503e8d341243080052b23c8de to your computer and use it in GitHub Desktop.
#!/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