Class: Aws::CloudWatch::Alarm
- Inherits:
-
Object
- Object
- Aws::CloudWatch::Alarm
- Extended by:
- Deprecations
- Defined in:
- sig/alarm.rbs,
lib/aws-sdk-cloudwatch/alarm.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#actions_enabled ⇒ Boolean
Indicates whether actions should be executed during any changes to the alarm state.
-
#alarm_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the
ALARMstate from any other state. -
#alarm_arn ⇒ String
The Amazon Resource Name (ARN) of the alarm.
-
#alarm_configuration_updated_timestamp ⇒ Time
The time stamp of the last update to the alarm configuration.
-
#alarm_description ⇒ String
The description of the alarm.
-
#comparison_operator ⇒ String
The arithmetic operation to use when comparing the specified statistic and threshold.
-
#datapoints_to_alarm ⇒ Integer
The number of data points that must be breaching to trigger the alarm.
-
#dimensions ⇒ Array<Types::Dimension>
The dimensions for the metric associated with the alarm.
-
#evaluate_low_sample_count_percentile ⇒ String
Used only for alarms based on percentiles.
-
#evaluation_criteria ⇒ Types::EvaluationCriteria
The evaluation criteria for the alarm.
-
#evaluation_interval ⇒ Integer
The frequency, in seconds, at which the alarm is evaluated.
-
#evaluation_periods ⇒ Integer
The number of periods over which data is compared to the specified threshold.
-
#evaluation_state ⇒ String
If the value of this field is
PARTIAL_DATA, it indicates that not all the available data was able to be retrieved due to quota limitations. -
#evaluation_window ⇒ Types::EvaluationWindow
The evaluation window that the alarm uses to select the range of metric data that it evaluates.
-
#extended_statistic ⇒ String
The percentile statistic for the metric associated with the alarm.
-
#insufficient_data_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the
INSUFFICIENT_DATAstate from any other state. -
#metric_name ⇒ String
The name of the metric associated with the alarm, if this is an alarm based on a single metric.
-
#metrics ⇒ Array<Types::MetricDataQuery>
An array of MetricDataQuery structures, used in an alarm based on a metric math expression.
- #name ⇒ String (also: #alarm_name)
-
#namespace ⇒ String
The namespace of the metric associated with the alarm.
-
#ok_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the
OKstate from any other state. -
#period ⇒ Integer
The period, in seconds, over which the statistic is applied.
-
#state_reason ⇒ String
An explanation for the alarm state, in text format.
-
#state_reason_data ⇒ String
An explanation for the alarm state, in JSON format.
-
#state_transitioned_timestamp ⇒ Time
The date and time that the alarm's
StateValuemost recently changed. -
#state_updated_timestamp ⇒ Time
The time stamp of the last update to the value of either the
StateValueorEvaluationStateparameters. -
#state_value ⇒ String
The state value for the alarm.
-
#statistic ⇒ String
The statistic for the metric associated with the alarm, other than percentile.
-
#threshold ⇒ Float
The value to compare with the specified statistic.
-
#threshold_metric_id ⇒ String
In an alarm based on an anomaly detection model, this is the ID of the
ANOMALY_DETECTION_BANDfunction used as the threshold for the alarm. -
#treat_missing_data ⇒ String
Sets how this alarm is to handle missing data points.
-
#unit ⇒ String
The unit of the metric associated with the alarm.
-
#warm_up_configuration ⇒ Types::WarmUpConfiguration
The warm-up configuration for the alarm.
Actions collapse
- #delete(options = {}) ⇒ EmptyStructure
- #describe_history(options = {}) ⇒ Types::DescribeAlarmHistoryOutput
- #disable_actions(options = {}) ⇒ EmptyStructure
- #enable_actions(options = {}) ⇒ EmptyStructure
- #set_state(options = {}) ⇒ EmptyStructure
Associations collapse
- #identifiers ⇒ Object deprecated private Deprecated.
- #metric ⇒ Metric?
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::MetricAlarm
Returns the data for this Alarm.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#exists?(options = {}) ⇒ Boolean
Returns
trueif the Alarm exists. -
#initialize(*args) ⇒ Alarm
constructor
A new instance of Alarm.
- #load ⇒ self (also: #reload)
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::CloudWatch::Client] #wait_until instead
- #wait_until_exists(options = {}, &block) ⇒ Alarm
Constructor Details
Instance Method Details
#actions_enabled ⇒ Boolean
Indicates whether actions should be executed during any changes to the alarm state.
31 |
# File 'sig/alarm.rbs', line 31 def actions_enabled: () -> bool |
#alarm_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the ALARM
state from any other state. Each action is specified as an Amazon
Resource Name (ARN).
37 |
# File 'sig/alarm.rbs', line 37 def alarm_actions: () -> ::Array[::String] |
#alarm_arn ⇒ String
The Amazon Resource Name (ARN) of the alarm.
22 |
# File 'sig/alarm.rbs', line 22 def alarm_arn: () -> ::String |
#alarm_configuration_updated_timestamp ⇒ Time
The time stamp of the last update to the alarm configuration.
28 |
# File 'sig/alarm.rbs', line 28 def alarm_configuration_updated_timestamp: () -> ::Time |
#alarm_description ⇒ String
The description of the alarm.
25 |
# File 'sig/alarm.rbs', line 25 def alarm_description: () -> ::String |
#client ⇒ Client
303 |
# File 'lib/aws-sdk-cloudwatch/alarm.rb', line 303 def client: () -> Client |
#comparison_operator ⇒ String
The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.
85 |
# File 'sig/alarm.rbs', line 85 def comparison_operator: () -> ("GreaterThanOrEqualToThreshold" | "GreaterThanThreshold" | "LessThanThreshold" | "LessThanOrEqualToThreshold" | "LessThanLowerOrGreaterThanUpperThreshold" | "LessThanLowerThreshold" | "GreaterThanUpperThreshold") |
#data ⇒ Types::MetricAlarm
124 |
# File 'sig/alarm.rbs', line 124 def data: () -> Types::MetricAlarm |
#data_loaded? ⇒ Boolean
127 |
# File 'sig/alarm.rbs', line 127 def data_loaded?: () -> bool |
#datapoints_to_alarm ⇒ Integer
The number of data points that must be breaching to trigger the alarm.
79 |
# File 'sig/alarm.rbs', line 79 def datapoints_to_alarm: () -> ::Integer |
#delete(options = {}) ⇒ EmptyStructure
138 |
# File 'sig/alarm.rbs', line 138 def delete: ( |
#describe_history(options = {}) ⇒ Types::DescribeAlarmHistoryOutput
143 |
# File 'sig/alarm.rbs', line 143 def describe_history: ( |
#dimensions ⇒ Array<Types::Dimension>
The dimensions for the metric associated with the alarm.
67 |
# File 'sig/alarm.rbs', line 67 def dimensions: () -> ::Array[Types::Dimension] |
#disable_actions(options = {}) ⇒ EmptyStructure
156 |
# File 'sig/alarm.rbs', line 156 def disable_actions: ( |
#enable_actions(options = {}) ⇒ EmptyStructure
161 |
# File 'sig/alarm.rbs', line 161 def enable_actions: ( |
#evaluate_low_sample_count_percentile ⇒ String
Used only for alarms based on percentiles. If ignore, the alarm
state does not change during periods with too few data points to be
statistically significant. If evaluate or this parameter is not
used, the alarm is always evaluated and possibly changes state no
matter how many data points are available.
91 |
# File 'sig/alarm.rbs', line 91 def evaluate_low_sample_count_percentile: () -> ::String |
#evaluation_criteria ⇒ Types::EvaluationCriteria
The evaluation criteria for the alarm.
112 |
# File 'sig/alarm.rbs', line 112 def evaluation_criteria: () -> Types::EvaluationCriteria |
#evaluation_interval ⇒ Integer
The frequency, in seconds, at which the alarm is evaluated.
115 |
# File 'sig/alarm.rbs', line 115 def evaluation_interval: () -> ::Integer |
#evaluation_periods ⇒ Integer
The number of periods over which data is compared to the specified threshold.
76 |
# File 'sig/alarm.rbs', line 76 def evaluation_periods: () -> ::Integer |
#evaluation_state ⇒ String
If the value of this field is PARTIAL_DATA, it indicates that not
all the available data was able to be retrieved due to quota
limitations. For more information, see Create alarms on Metrics
Insights queries.
If the value of this field is EVALUATION_ERROR, it indicates
configuration errors in alarm setup that require review and
correction. Refer to StateReason field of the alarm for more details.
If the value of this field is EVALUATION_FAILURE, it indicates
temporary CloudWatch issues. We recommend manual monitoring until the
issue is resolved
100 |
# File 'sig/alarm.rbs', line 100 def evaluation_state: () -> ("PARTIAL_DATA" | "EVALUATION_FAILURE" | "EVALUATION_ERROR") |
#evaluation_window ⇒ Types::EvaluationWindow
The evaluation window that the alarm uses to select the range of metric data that it evaluates. This is either a sliding window or a wall clock window. For more information, see Alarm evaluation windows in the CloudWatch User Guide.
106 |
# File 'sig/alarm.rbs', line 106 def evaluation_window: () -> Types::EvaluationWindow |
#exists?(options = {}) ⇒ Boolean
130 131 |
# File 'sig/alarm.rbs', line 130 def exists?: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) -> bool | (?Hash[Symbol, untyped]) -> bool |
#extended_statistic ⇒ String
The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
64 |
# File 'sig/alarm.rbs', line 64 def extended_statistic: () -> ::String |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
602 603 604 |
# File 'lib/aws-sdk-cloudwatch/alarm.rb', line 602 def identifiers { name: @name } end |
#insufficient_data_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the
INSUFFICIENT_DATA state from any other state. Each action is
specified as an Amazon Resource Name (ARN).
40 |
# File 'sig/alarm.rbs', line 40 def insufficient_data_actions: () -> ::Array[::String] |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::CloudWatch::Alarm.
Returns self making it possible to chain methods.
alarm.reload.data
120 |
# File 'sig/alarm.rbs', line 120 def load: () -> self |
#metric ⇒ Metric?
174 |
# File 'sig/alarm.rbs', line 174 def metric: () -> Metric? |
#metric_name ⇒ String
The name of the metric associated with the alarm, if this is an alarm based on a single metric.
55 |
# File 'sig/alarm.rbs', line 55 def metric_name: () -> ::String |
#metrics ⇒ Array<Types::MetricDataQuery>
An array of MetricDataQuery structures, used in an alarm based on a
metric math expression. Each structure either retrieves a metric or
performs a math expression. One item in the Metrics array is the math
expression that the alarm watches. This expression by designated by
having ReturnData set to true.
94 |
# File 'sig/alarm.rbs', line 94 def metrics: () -> ::Array[Types::MetricDataQuery] |
#name ⇒ String Also known as: alarm_name
18 |
# File 'sig/alarm.rbs', line 18 def name: () -> String |
#namespace ⇒ String
The namespace of the metric associated with the alarm.
58 |
# File 'sig/alarm.rbs', line 58 def namespace: () -> ::String |
#ok_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the OK state
from any other state. Each action is specified as an Amazon Resource
Name (ARN).
34 |
# File 'sig/alarm.rbs', line 34 def ok_actions: () -> ::Array[::String] |
#period ⇒ Integer
The period, in seconds, over which the statistic is applied.
70 |
# File 'sig/alarm.rbs', line 70 def period: () -> ::Integer |
#set_state(options = {}) ⇒ EmptyStructure
166 |
# File 'sig/alarm.rbs', line 166 def set_state: ( |
#state_reason ⇒ String
An explanation for the alarm state, in text format.
46 |
# File 'sig/alarm.rbs', line 46 def state_reason: () -> ::String |
#state_reason_data ⇒ String
An explanation for the alarm state, in JSON format.
49 |
# File 'sig/alarm.rbs', line 49 def state_reason_data: () -> ::String |
#state_transitioned_timestamp ⇒ Time
The date and time that the alarm's StateValue most recently
changed.
103 |
# File 'sig/alarm.rbs', line 103 def state_transitioned_timestamp: () -> ::Time |
#state_updated_timestamp ⇒ Time
The time stamp of the last update to the value of either the
StateValue or EvaluationState parameters.
52 |
# File 'sig/alarm.rbs', line 52 def state_updated_timestamp: () -> ::Time |
#state_value ⇒ String
The state value for the alarm.
43 |
# File 'sig/alarm.rbs', line 43 def state_value: () -> ("OK" | "ALARM" | "INSUFFICIENT_DATA") |
#statistic ⇒ String
The statistic for the metric associated with the alarm, other than
percentile. For percentile statistics, use ExtendedStatistic.
61 |
# File 'sig/alarm.rbs', line 61 def statistic: () -> ("SampleCount" | "Average" | "Sum" | "Minimum" | "Maximum") |
#threshold ⇒ Float
The value to compare with the specified statistic.
82 |
# File 'sig/alarm.rbs', line 82 def threshold: () -> ::Float |
#threshold_metric_id ⇒ String
In an alarm based on an anomaly detection model, this is the ID of the
ANOMALY_DETECTION_BAND function used as the threshold for the alarm.
97 |
# File 'sig/alarm.rbs', line 97 def threshold_metric_id: () -> ::String |
#treat_missing_data ⇒ String
Sets how this alarm is to handle missing data points. The valid values
are breaching, notBreaching, ignore, and missing. For more
information, see Configuring how CloudWatch alarms treat missing
data.
If this parameter is omitted, the default behavior of missing is
used.
88 |
# File 'sig/alarm.rbs', line 88 def treat_missing_data: () -> ::String |
#unit ⇒ String
The unit of the metric associated with the alarm.
73 |
# File 'sig/alarm.rbs', line 73 def unit: () -> ("Seconds" | "Microseconds" | "Milliseconds" | "Bytes" | "Kilobytes" | "Megabytes" | "Gigabytes" | "Terabytes" | "Bits" | "Kilobits" | "Megabits" | "Gigabits" | "Terabits" | "Percent" | "Count" | "Bytes/Second" | "Kilobytes/Second" | "Megabytes/Second" | "Gigabytes/Second" | "Terabytes/Second" | "Bits/Second" | "Kilobits/Second" | "Megabits/Second" | "Gigabits/Second" | "Terabits/Second" | "Count/Second" | "None") |
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::CloudWatch::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
# File 'lib/aws-sdk-cloudwatch/alarm.rb', line 450 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |
#wait_until_exists(options = {}, &block) ⇒ Alarm
134 135 |
# File 'sig/alarm.rbs', line 134 def wait_until_exists: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) ?{ (untyped waiter) -> void } -> Alarm | (?Hash[Symbol, untyped]) ?{ (untyped waiter) -> void } -> Alarm |
#warm_up_configuration ⇒ Types::WarmUpConfiguration
The warm-up configuration for the alarm. A warm-up period delays alarm
evaluation after you create or update the alarm. During the warm-up
period, the alarm stays in INSUFFICIENT_DATA and does not perform
alarm actions.
For more information, see Alarm warm-up periods in the Amazon CloudWatch User Guide.
109 |
# File 'sig/alarm.rbs', line 109 def warm_up_configuration: () -> Types::WarmUpConfiguration |