Skip to content

Instantly share code, notes, and snippets.

@nz
Created December 5, 2012 16:50
Show Gist options
  • Save nz/4217338 to your computer and use it in GitHub Desktop.
Save nz/4217338 to your computer and use it in GitHub Desktop.
Add CloudWatch StatusCheckFailed alarm to all instances (wip)
# Still a WIP while I read up on what all the API attributes are. Suggestions welcome. ;)
require 'fog'
require 'fog/aws/cloud_watch/alarm'
include Fog::AWS::CloudWatch
conn = Fog::Compute.new provider: 'AWS'
conn.servers.each do |srv|
Alarm.new({
connection: conn,
id: srv.id,
comparison_operator: '>',
metric_name: 'StatusCheckFailed',
period: 60,
statistic: 'Maximum',
threshold: '1.0'
})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment