Skip to content

Instantly share code, notes, and snippets.

@csereno
Last active July 30, 2023 19:44
Show Gist options
  • Select an option

  • Save csereno/2c22d526318c61ebf9d3e9bf2dbd5141 to your computer and use it in GitHub Desktop.

Select an option

Save csereno/2c22d526318c61ebf9d3e9bf2dbd5141 to your computer and use it in GitHub Desktop.

Revisions

  1. csereno revised this gist Jan 23, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions CloudWatch_Alarms_CLI_Commands
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    Reference: https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/put-metric-alarm.html

    ===HIGH CPU===
    aws cloudwatch put-metric-alarm --alarm-name "High CPU Util on INSTANCE" --alarm-description "Alarm when CPU exceeds 90 percent" --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 300 --threshold 90 --comparison-operator GreaterThanThreshold --dimensions "Name=InstanceId,Value=INSTANCE" --evaluation-periods 2 --alarm-actions "arn:aws:sns:REGION:ACCOUNT:SNSTOPIC" --unit Percent

  2. csereno created this gist Jan 22, 2019.
    11 changes: 11 additions & 0 deletions CloudWatch_Alarms_CLI_Commands
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    ===HIGH CPU===
    aws cloudwatch put-metric-alarm --alarm-name "High CPU Util on INSTANCE" --alarm-description "Alarm when CPU exceeds 90 percent" --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 300 --threshold 90 --comparison-operator GreaterThanThreshold --dimensions "Name=InstanceId,Value=INSTANCE" --evaluation-periods 2 --alarm-actions "arn:aws:sns:REGION:ACCOUNT:SNSTOPIC" --unit Percent

    ===HIGH MEM===
    aws cloudwatch put-metric-alarm --alarm-name "High Memory Util on INSTANCE" --alarm-description "Alarm when Memory exceeds 90 percent" --metric-name mem_used_percent --namespace AWS/EC2 --statistic Average --period 300 --threshold 90 --comparison-operator GreaterThanThreshold --dimensions "Name=InstanceId,Value=INSTANCEID" --evaluation-periods 2 --alarm-actions "arn:aws:sns:REGION:ACCOUNT:SNSTOPIC" --unit Percent

    ===StatusCheckFailed===
    aws cloudwatch put-metric-alarm --alarm-name "EC2 Status Check Failed --alarm-description "An EC2 Status Check Failed" --metric-name StatusCheckFailed --namespace AWS/EC2 --statistic Maximum --period 60 --unit Count --evaluation-periods 2 --threshold 1 --comparison-operator GreaterThanOrEqualToThreshold --dimensions "Name=InstanceID,Value=INSTANCEID" --treat-missing-data missing --alarm-actions "arn:aws:sns:REGION:ACCOUNT:SNSTOPIC"

    ===SystemStatusCheckFailed===
    aws cloudwatch put-metric-alarm --alarm-name "System Status Check Failed" --alarm-description "An EC2 System Status Check Failed" --metric-name StatusCheckFailed_System --namespace AWS/EC2 --statistic Maximum --period 60 --unit Count --evaluation-periods 2 --threshold 1 --comparison-operator GreaterThanOrEqualToThreshold --dimensions "Name=InstanceID,Value=INSTANCEID" --treat-missing-data missing --alarm-actions "arn:aws:sns:REGION:ACCOUNT:SNSTOPIC"