PutMetricAlarm
In this article:
PutMetricAlarm#
Description#
Creates of updates the alarm and links to the metric.
Request Parameters#
Required parameters#
AlarmName — The name for the alarm. This name must be unique within the project.
Required: Yes
Type: String
Length constraints: from 1 to 255 symbols
ComparisonOperator — The arithmetic operation to use when comparing the specified statistic and threshold.
Required: Yes
Type: String
Valid values:
GreaterThanThreshold
|GreaterThanOrEqualToThreshold
|LessThanOrEqualToThreshold
|LessThanThreshold
Dimensions.member.n — The alarm dimensions (for details, see user documentation).
Required: Yes
Type: List of Dimension objects
Length constraints: from 0 to 10 items
EvaluationPeriods — The number of periods which is compared to the threshold.
Required: Yes
Type: Integer
Valid range: Minimum value is
1
Constraints: The time period, that is set via EvaluationPeriods and Period should not exceed one day
MetricName — The name of the metric that associated with the alarm.
Required: Yes
Type: String
Length constraints: from 1 to 255 symbols
Namespace — The namespace of the metric with which the alarm is associated.
Required: Yes
Type: String
Length constraints: from 1 to 255 symbols
Period — The period in seconds over which the statistic is applied.
Required: Yes
Type: Integer
Valid range: Value must be divisible by 60, minimum value is
60
Constraints: The time period, that is set via EvaluationPeriods and Period should not exceed one day
Statistic — The statistic for the metric.
Required: Yes
Type: String
Valid values:
Average
|Sum
|SampleCount
|Maximum
|Minimum
Threshold — The value, to which metric values will be compared.
Required: Yes
Type: Double
Optional parameters#
ActionsEnabled — Indicates whether actions should be executed during any changes to the alarm state.
Required: No
Type: Boolean
AlarmActions.member.n — Actions, which must be executed when this alarm transitions to the
alarm
state.Required: No
Type: Array of strings
Valid values:
example@mail.com:EMAIL
Length constraints (list): from 0 to 5 items
Length constraints (element): from 1 to 1024 symbols
AlarmDescription — The alarm description.
Required: No
Type: String
Length constraints: from 1 to 255 symbols
DatapointsToAlarm — Number of datapoints that must be breaching to trigger the alarm.
Required: No
Type: Integer
Valid range: Minimum value —
1
, maximum value — EvaluationPeriodsDefault value: EvaluationPeriods
InsufficientDataActions.member.n — Actions, which must be executed when this alarm transitions to the
insufficient_data
state.Required: No
Type: Array of strings
Valid values:
example@mail.com:EMAIL
Length constraints (list): from 0 to 5 items
Length constraints (element): from 1 to 1024 symbols
OKActions.member.n — Actions, which must be executed when this alarm transitions to the
ok
state.Required: No
Type: Array of strings
Valid values:
example@mail.com:EMAIL
Length constraints (list): from 0 to 5 items
Length constraints (element): from 1 to 1024 symbols
TreatMissingData — This parameter defines how periods without values would be interpreted. There’re four possible options: keep considering them periods without values, ignore such periods, consider them breaching, consider them non-breaching.
Required: No
Type: String
Valid values:
missing
|ignore
|breaching
|non_breaching
Default value:
missing
Unit — The unit of the metric associated with the alarm.
Required: No
Type: String
Valid values:
Percent
|Bytes
|Count
Examples#
c2-cw PutMetricAlarm AlarmName <alarm_name> Period <period> MetricName <metric_name> \
Namespace <namespace> ComparisonOperator <comparison_operator> \
Threshold <threshold> EvaluationPeriods <evaluation_periods> \
Dimensions.member.1.Name "InstanceId" \
Dimensions.member.1.Value <instance_id> \
Statistic <statistic>
c2-cw PutMetricAlarm AlarmName <alarm_name> Period <period> MetricName <metric_name> \
Namespace <namespace> ComparisonOperator <comparison_operator> \
Threshold <threshold> EvaluationPeriods <evaluation_periods> \
Dimensions.member.1.Name "InstanceId" \
Dimensions.member.1.Value <instance_id> \
Statistic <statistic> OKActions.member.1 <ok_action_1>