Skip to content

Instantly share code, notes, and snippets.

@rterbush
Last active January 19, 2016 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rterbush/68c767f31e8f891b0ffd to your computer and use it in GitHub Desktop.
Save rterbush/68c767f31e8f891b0ffd to your computer and use it in GitHub Desktop.
{% for host, instance in salt['mine.get']('*', 'instance_id', expr_form='glob').items() %}
ensure_EC2_alarm_exists_{{- host}}:
boto_cloudwatch_alarm.present:
- name: {{ host -}}-cpuutilization-ec2-alarm
- region: {{ pillar['aws-region'] }}
- attributes:
metric: CPUUtilization
namespace: AWS/EC2
statistic: Average
comparison: '>='
threshold: 50.0
period: 60
evaluation_periods: 5
unit: null
description: 'EC2 CPUUtilization Alarm'
dimensions:
InstanceId: {{ instance }}
alarm_actions: ['{{- pillar['aws-noticearn'] -}}']
insufficient_data_actions: []
ok_actions: []
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment