class AWS::CloudWatch::Alarm


@attr_reader [String] unit The unit of the alarm’s associated metric.
statistic is compared.
@attr_reader [Float] threshold The value against which the specified
@attr_reader [String] state_value The state value for the alarm.
last updated.
@attr_reader [Time] state_updated_timestamp When the alarm’s state
state in machine-readable JSON format.
@attr_reader [String] state_reason_data An explanation for the alarm’s
the alarm’s state.
@attr_reader [String] state_reason A human-readable explanation for
statistic is applied.
@attr_reader [Integer] period The period in seconds over which the
when this alarm transitions into an OK state.
@attr_reader [Array<Hash>] ok_actions The list of actions to execute
INSUFFICIENT_DATA state
actions to execute when this alarm transitions into an
@attr_reader [Array<Hash>] insufficient_data_actions The list of
which data is compared to the specified threshold.
@attr_reader [Integer] evaluation_periods The number of periods over
specified Statistic value is used as the first operand.
use when comparing the specified Statistic and Threshold. The
@attr_reader [String] comparison_operator The arithmetic operation to
@attr_reader [String] description The description for the alarm.
The time stamp of the last update to the alarm configuration.
@attr_reader [Time] configuration_updated_timestamp
@attr_reader [String] arn The Amazon Resource Name (ARN) of the alarm.
state.
when this alarm transitions into an ALARM state from any other
@attr_reader [Array<String>] alarm_actions The list of actions to execute
should be executed during any changes to the alarm’s state.
@attr_reader [Boolean] enabled Indicates whether actions
@attr_reader [Array<Hash>] dimensions
@attr_reader [String] namespace
@attr_reader [String] metric_name

def delete

Returns:
  • (nil) -
def delete
  client.delete_alarms(:alarm_names => [ alarm_name ])
  nil
end

def disable

Returns:
  • (nil) -
def disable
  client.disable_alarm_actions(:alarm_names => [ alarm_name ])
  nil
end

def enable

Returns:
  • (nil) -
def enable
  client.enable_alarm_actions(:alarm_names => [ alarm_name ])
  nil
end

def exists?

Returns:
  • (Boolean) - Returns true if this alarm exists.
def exists?
  !get_resource.data[:metric_alarms].empty?
end

def get_resource attr_name = nil

def get_resource attr_name = nil
  client.describe_alarms(:alarm_names => [ alarm_name ])
end

def history_items options = {}

Returns:
  • (AlarmHistoryItemCollection) -
def history_items options = {}
  AlarmHistoryItemCollection.new(:config => config).with_alarm_name(name)
end

def initialize alarm_name, options = {}

Other tags:
    Api: - private
def initialize alarm_name, options = {}
  @alarm_name = alarm_name
  super
end

def metric

Returns:
  • (Metric) -
def metric
  options = {}
  options[:dimensions] = dimensions unless dimensions.empty?
  options[:config] = config
  Metric.new(namespace, metric_name, options)
end

def resource_identifiers

def resource_identifiers
  [[:alarm_name, alarm_name]]
end

def set_state reason, value, options = {}

Returns:
  • (nil) -

Options Hash: (**options)
  • :state_reason_data (String) -- The reason that this

Parameters:
  • options (Hash) --
  • value (String) -- Valid values include:
  • reason (String) -- The reason that this alarm is set to this
def set_state reason, value, options = {}
  options[:alarm_name] = alarm_name
  options[:state_reason] = reason
  options[:state_value] = value
  client.set_alarm_state(options)
  nil
end

def update options = {}

Returns:
  • (nil) -

Options Hash: (**options)
  • :unit (String) -- The unit for the alarm's associated
  • :alarm_description (String) -- The description for
  • :alarm_actions (Array) -- The list of actions
  • :actions_enabled (Boolean) -- Indicates whether or not
  • :ok_actions (Array) -- The list of actions to
  • :insufficient_data_actions (Array) --
  • :threshold (Number, required) -- The value against which
  • :statistic (String, required) -- The statistic to apply
  • :period (Integer, required) -- The period in seconds
  • :evaluation_periods (Integer, required) -- The number
  • :comparison_operator (String, required) -- The arithmetic
def update options = {}
  options[:alarm_name] = alarm_name
  client.put_metric_alarm(options)
  nil
end