You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.
Class: AWS::CloudWatch::Alarm
- Inherits:
-
AWS::Core::Resource
- Object
- AWS::Core::Resource
- AWS::CloudWatch::Alarm
- Defined in:
- lib/aws/cloud_watch/alarm.rb
Instance Attribute Summary collapse
-
#alarm_actions ⇒ Array<String>
(also: #actions)
readonly
The list of actions to execute when this alarm transitions into an ALARM state from any other state.
-
#alarm_name ⇒ String
(also: #name)
readonly
-
#comparison_operator ⇒ String
readonly
The arithmetic operation to use when comparing the specified Statistic and Threshold.
-
#dimensions ⇒ Array<Hash>
readonly
The current value of dimensions.
-
#evaluation_periods ⇒ Integer
readonly
The number of periods over which data is compared to the specified threshold.
-
#insufficient_data_actions ⇒ Array<Hash>
readonly
The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state.
-
#metric_name ⇒ String
readonly
The current value of metric_name.
-
#namespace ⇒ String
readonly
The current value of namespace.
-
#ok_actions ⇒ Array<Hash>
readonly
The list of actions to execute when this alarm transitions into an OK state.
-
#period ⇒ Integer
readonly
The period in seconds over which the statistic is applied.
-
#state_reason ⇒ String
readonly
A human-readable explanation for the alarm's state.
-
#state_reason_data ⇒ String
readonly
An explanation for the alarm's state in machine-readable JSON format.
-
#state_updated_timestamp ⇒ Time
readonly
When the alarm's state last updated.
-
#state_value ⇒ String
readonly
The state value for the alarm.
-
#threshold ⇒ Float
readonly
The value against which the specified statistic is compared.
-
#unit ⇒ String
readonly
The unit of the alarm's associated metric.
Instance Method Summary collapse
-
#delete ⇒ nil
Deletes the current alarm.
-
#disable ⇒ nil
Disable the current alarm actions.
-
#enable ⇒ nil
Enable the current alarm actions.
-
#exists? ⇒ Boolean
Returns true if this alarm exists.
-
#history_items(options = {}) ⇒ AlarmHistoryItemCollection
(also: #history, #histories)
Returns a collection of the history items for current alarm.
-
#metric ⇒ Metric
-
#set_state(reason, value, options = {}) ⇒ nil
Temporarily sets the state of current alarm.
-
#update(options = {}) ⇒ nil
Updates the metric alarm.
Instance Attribute Details
#alarm_actions ⇒ Array<String> (readonly) Also known as: actions
The list of actions to execute when this alarm transitions into an ALARM state from any other state.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def alarm_actions @alarm_actions end |
#alarm_name ⇒ String (readonly) Also known as: name
79 80 81 |
# File 'lib/aws/cloud_watch/alarm.rb', line 79 def alarm_name @alarm_name end |
#comparison_operator ⇒ String (readonly)
The arithmetic operation to use when comparing the specified Statistic and Threshold. The specified Statistic value is used as the first operand.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def comparison_operator @comparison_operator end |
#dimensions ⇒ Array<Hash> (readonly)
Returns the current value of dimensions
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def dimensions @dimensions end |
#evaluation_periods ⇒ Integer (readonly)
The number of periods over which data is compared to the specified threshold.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def evaluation_periods @evaluation_periods end |
#insufficient_data_actions ⇒ Array<Hash> (readonly)
The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def insufficient_data_actions @insufficient_data_actions end |
#metric_name ⇒ String (readonly)
Returns the current value of metric_name
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def metric_name @metric_name end |
#namespace ⇒ String (readonly)
Returns the current value of namespace
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def namespace @namespace end |
#ok_actions ⇒ Array<Hash> (readonly)
The list of actions to execute when this alarm transitions into an OK state.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def ok_actions @ok_actions end |
#period ⇒ Integer (readonly)
The period in seconds over which the statistic is applied.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def period @period end |
#state_reason ⇒ String (readonly)
A human-readable explanation for the alarm's state.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def state_reason @state_reason end |
#state_reason_data ⇒ String (readonly)
An explanation for the alarm's state in machine-readable JSON format.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def state_reason_data @state_reason_data end |
#state_updated_timestamp ⇒ Time (readonly)
When the alarm's state last updated.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def @state_updated_timestamp end |
#state_value ⇒ String (readonly)
The state value for the alarm.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def state_value @state_value end |
#threshold ⇒ Float (readonly)
The value against which the specified statistic is compared.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def threshold @threshold end |
#unit ⇒ String (readonly)
The unit of the alarm's associated metric.
70 71 72 |
# File 'lib/aws/cloud_watch/alarm.rb', line 70 def unit @unit end |
Instance Method Details
#delete ⇒ nil
Deletes the current alarm.
224 225 226 227 |
# File 'lib/aws/cloud_watch/alarm.rb', line 224 def delete client.delete_alarms(:alarm_names => [ alarm_name ]) nil end |
#disable ⇒ nil
Disable the current alarm actions.
231 232 233 234 |
# File 'lib/aws/cloud_watch/alarm.rb', line 231 def disable client.disable_alarm_actions(:alarm_names => [ alarm_name ]) nil end |
#enable ⇒ nil
Enable the current alarm actions.
238 239 240 241 |
# File 'lib/aws/cloud_watch/alarm.rb', line 238 def enable client.enable_alarm_actions(:alarm_names => [ alarm_name ]) nil end |
#exists? ⇒ Boolean
Returns true if this alarm exists.
244 245 246 |
# File 'lib/aws/cloud_watch/alarm.rb', line 244 def exists? !get_resource.data[:metric_alarms].empty? end |
#history_items(options = {}) ⇒ AlarmHistoryItemCollection Also known as: history, histories
Returns a collection of the history items for current alarm.
250 251 252 |
# File 'lib/aws/cloud_watch/alarm.rb', line 250 def history_items = {} AlarmHistoryItemCollection.new(:config => config).with_alarm_name(name) end |
#metric ⇒ Metric
145 146 147 148 149 150 |
# File 'lib/aws/cloud_watch/alarm.rb', line 145 def metric = {} [:dimensions] = dimensions unless dimensions.empty? [:config] = config Metric.new(namespace, metric_name, ) end |
#set_state(reason, value, options = {}) ⇒ nil
Temporarily sets the state of current alarm.
273 274 275 276 277 278 279 |
# File 'lib/aws/cloud_watch/alarm.rb', line 273 def set_state reason, value, = {} [:alarm_name] = alarm_name [:state_reason] = reason [:state_value] = value client.set_alarm_state() nil end |
#update(options = {}) ⇒ nil
Updates the metric alarm.
216 217 218 219 220 |
# File 'lib/aws/cloud_watch/alarm.rb', line 216 def update = {} [:alarm_name] = alarm_name client.put_metric_alarm() nil end |