Class | AWS::CloudWatch::AlarmCollection |
In: |
lib/aws/cloud_watch/alarm_collection.rb
|
Parent: | Object |
Represents alarms for an AWS account.
## Getting an alarm by name
If you know the name of the alarm, you can get a reference using the {#[]} method.
cw = AWS::CloudWatch.new alarm = cw.alarms['alarm-name']
## Enumerating Alarms
You can enumerate all alarms using each (or any of the methods defined in {Core::Collection}).
cw.alarms.each do |alarm| puts alarm.name end
## Filtering Alarms
Use one of the filtering methods to reduce the number of alarms returned.
cw.alarms.with_name_prefix('some-prefix-').each {|alarm| ... }
Creates an alarm and associates it with the specified metric.
@param [String] alarm_name The descriptive name for the alarm.
This name must be unique within the user's AWS account.
@param [Hash] options @option options [String,required] :namespace The namespace for the
alarm's associated metric.
@option options [String,required] :metric_name The name for the
alarm's associated metric.
@option options [Array<Hash>] :dimensions The dimensions for the
alarm's associated metric. Each dimension must specify a `:name` and a `:value`.
@option (see Alarm#update) @return [Alarm]
Delete one or more alarms by name.
cloud_watch.alarms.delete('alarm1', 'alarm2')
@param [String,Array<String>] alarm_names @return [nil]
@param [String,Array<String>] names A list of alarm names to
retrieve information for.
@return [MetricAlarmCollection]
@param [String] prefix The alarm name prefix. @return [MetricAlarmCollection]
@param [String] state The state value to be used in matching alarms. @return [MetricAlarmCollection]