CfnAlarmPropsMixin
- class aws_cdk.mixins_preview.aws_cloudwatch.mixins.CfnAlarmPropsMixin(props, *, strategy=None)
Bases:
MixinThe
AWS::CloudWatch::Alarmtype specifies an alarm and associates it with the specified metric or metric math expression.When this operation creates an alarm, the alarm state is immediately set to
INSUFFICIENT_DATA. The alarm is then evaluated and its state is set appropriately. Any actions associated with the new state are then executed.When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.
- See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-alarm.html
- CloudformationResource:
AWS::CloudWatch::Alarm
- Mixin:
true
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview import mixins from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins cfn_alarm_props_mixin = cloudwatch_mixins.CfnAlarmPropsMixin(cloudwatch_mixins.CfnAlarmMixinProps( actions_enabled=False, alarm_actions=["alarmActions"], alarm_description="alarmDescription", alarm_name="alarmName", comparison_operator="comparisonOperator", datapoints_to_alarm=123, dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty( name="name", value="value" )], evaluate_low_sample_count_percentile="evaluateLowSampleCountPercentile", evaluation_periods=123, extended_statistic="extendedStatistic", insufficient_data_actions=["insufficientDataActions"], metric_name="metricName", metrics=[cloudwatch_mixins.CfnAlarmPropsMixin.MetricDataQueryProperty( account_id="accountId", expression="expression", id="id", label="label", metric_stat=cloudwatch_mixins.CfnAlarmPropsMixin.MetricStatProperty( metric=cloudwatch_mixins.CfnAlarmPropsMixin.MetricProperty( dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty( name="name", value="value" )], metric_name="metricName", namespace="namespace" ), period=123, stat="stat", unit="unit" ), period=123, return_data=False )], namespace="namespace", ok_actions=["okActions"], period=123, statistic="statistic", tags=[CfnTag( key="key", value="value" )], threshold=123, threshold_metric_id="thresholdMetricId", treat_missing_data="treatMissingData", unit="unit" ), strategy=mixins.PropertyMergeStrategy.OVERRIDE )
Create a mixin to apply properties to
AWS::CloudWatch::Alarm.- Parameters:
props (
Union[CfnAlarmMixinProps,Dict[str,Any]]) – L1 properties to apply.strategy (
Optional[PropertyMergeStrategy]) – (experimental) Strategy for merging nested properties. Default: - PropertyMergeStrategy.MERGE
Methods
- apply_to(construct)
Apply the mixin properties to the construct.
- Parameters:
construct (
IConstruct)- Return type:
- supports(construct)
Check if this mixin supports the given construct.
- Parameters:
construct (
IConstruct)- Return type:
bool
Attributes
- CFN_PROPERTY_KEYS = ['actionsEnabled', 'alarmActions', 'alarmDescription', 'alarmName', 'comparisonOperator', 'datapointsToAlarm', 'dimensions', 'evaluateLowSampleCountPercentile', 'evaluationPeriods', 'extendedStatistic', 'insufficientDataActions', 'metricName', 'metrics', 'namespace', 'okActions', 'period', 'statistic', 'tags', 'threshold', 'thresholdMetricId', 'treatMissingData', 'unit']
Static Methods
- classmethod is_mixin(x)
(experimental) Checks if
xis a Mixin.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsMixin.- Stability:
experimental
DimensionProperty
- class CfnAlarmPropsMixin.DimensionProperty(*, name=None, value=None)
Bases:
objectDimension is an embedded property of the
AWS::CloudWatch::Alarmtype.Dimensions are name/value pairs that can be associated with a CloudWatch metric. You can specify a maximum of 30 dimensions for a given metric.
- Parameters:
name (
Optional[str]) – The name of the dimension, from 1–255 characters in length. This dimension name must have been included when the metric was published.value (
Optional[str]) – The value for the dimension, from 1–255 characters in length.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins dimension_property = cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty( name="name", value="value" )
Attributes
- name
The name of the dimension, from 1–255 characters in length.
This dimension name must have been included when the metric was published.
- value
The value for the dimension, from 1–255 characters in length.
MetricDataQueryProperty
- class CfnAlarmPropsMixin.MetricDataQueryProperty(*, account_id=None, expression=None, id=None, label=None, metric_stat=None, period=None, return_data=None)
Bases:
objectThe
MetricDataQueryproperty type specifies the metric data to return, and whether this call is just retrieving a batch set of data for one metric, or is performing a math expression on metric data.Any expression used must return a single time series. For more information, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide .
- Parameters:
account_id (
Optional[str]) – The ID of the account where the metrics are located, if this is a cross-account alarm.expression (
Optional[str]) –The math expression to be performed on the returned data, if this object is performing a math expression. This expression can use the
Idof the other metrics to refer to those metrics, and can also use theIdof other expressions to use the result of those expressions. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide . Within each MetricDataQuery object, you must specify eitherExpressionorMetricStatbut not both.id (
Optional[str]) – A short name used to tie this object to the results in the response. This name must be unique within a single call toGetMetricData. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.label (
Optional[str]) – A human-readable label for this metric or expression. This is especially useful if this is an expression, so that you know what the value represents. If the metric or expression is shown in a CloudWatch dashboard widget, the label is shown. IfLabelis omitted, CloudWatch generates a default.metric_stat (
Union[IResolvable,MetricStatProperty,Dict[str,Any],None]) – The metric to be returned, along with statistics, period, and units. Use this parameter only if this object is retrieving a metric and not performing a math expression on returned data. Within one MetricDataQuery object, you must specify eitherExpressionorMetricStatbut not both.period (
Union[int,float,None]) – The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by aPutMetricDataoperation that includes aStorageResolution of 1 second.return_data (
Union[bool,IResolvable,None]) – This option indicates whether to return the timestamps and raw data values of this metric. When you create an alarm based on a metric math expression, specifyTruefor this value for only the one math expression that the alarm is based on. You must specifyFalseforReturnDatafor all the other metrics and expressions used in the alarm. This field is required.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins metric_data_query_property = cloudwatch_mixins.CfnAlarmPropsMixin.MetricDataQueryProperty( account_id="accountId", expression="expression", id="id", label="label", metric_stat=cloudwatch_mixins.CfnAlarmPropsMixin.MetricStatProperty( metric=cloudwatch_mixins.CfnAlarmPropsMixin.MetricProperty( dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty( name="name", value="value" )], metric_name="metricName", namespace="namespace" ), period=123, stat="stat", unit="unit" ), period=123, return_data=False )
Attributes
- account_id
The ID of the account where the metrics are located, if this is a cross-account alarm.
- expression
The math expression to be performed on the returned data, if this object is performing a math expression.
This expression can use the
Idof the other metrics to refer to those metrics, and can also use theIdof other expressions to use the result of those expressions. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide .Within each MetricDataQuery object, you must specify either
ExpressionorMetricStatbut not both.
- id
A short name used to tie this object to the results in the response.
This name must be unique within a single call to
GetMetricData. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.
- label
A human-readable label for this metric or expression.
This is especially useful if this is an expression, so that you know what the value represents. If the metric or expression is shown in a CloudWatch dashboard widget, the label is shown. If
Labelis omitted, CloudWatch generates a default.
- metric_stat
The metric to be returned, along with statistics, period, and units.
Use this parameter only if this object is retrieving a metric and not performing a math expression on returned data.
Within one MetricDataQuery object, you must specify either
ExpressionorMetricStatbut not both.
- period
The granularity, in seconds, of the returned data points.
For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a
PutMetricDataoperation that includes aStorageResolution of 1 second.
- return_data
This option indicates whether to return the timestamps and raw data values of this metric.
When you create an alarm based on a metric math expression, specify
Truefor this value for only the one math expression that the alarm is based on. You must specifyFalseforReturnDatafor all the other metrics and expressions used in the alarm.This field is required.
MetricProperty
- class CfnAlarmPropsMixin.MetricProperty(*, dimensions=None, metric_name=None, namespace=None)
Bases:
objectThe
Metricproperty type represents a specific metric.Metricis a property of the MetricStat property type.- Parameters:
dimensions (
Union[IResolvable,Sequence[Union[IResolvable,DimensionProperty,Dict[str,Any]]],None]) – The metric dimensions that you want to be used for the metric that the alarm will watch.metric_name (
Optional[str]) – The name of the metric that you want the alarm to watch. This is a required field.namespace (
Optional[str]) – The namespace of the metric that the alarm will watch.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins metric_property = cloudwatch_mixins.CfnAlarmPropsMixin.MetricProperty( dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty( name="name", value="value" )], metric_name="metricName", namespace="namespace" )
Attributes
- dimensions
The metric dimensions that you want to be used for the metric that the alarm will watch.
- metric_name
The name of the metric that you want the alarm to watch.
This is a required field.
- namespace
The namespace of the metric that the alarm will watch.
MetricStatProperty
- class CfnAlarmPropsMixin.MetricStatProperty(*, metric=None, period=None, stat=None, unit=None)
Bases:
objectThis structure defines the metric to be returned, along with the statistics, period, and units.
MetricStatis a property of the MetricDataQuery property type.- Parameters:
metric (
Union[IResolvable,MetricProperty,Dict[str,Any],None]) – The metric to return, including the metric name, namespace, and dimensions.period (
Union[int,float,None]) – The granularity, in seconds, of the returned data points. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by aPutMetricDatacall that includes aStorageResolutionof 1 second. If theStartTimeparameter specifies a time stamp that is greater than 3 hours ago, you must specify the period as follows or no data points in that time range is returned: - Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute). - Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes). - Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).stat (
Optional[str]) – The statistic to return. It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .unit (
Optional[str]) – The unit to use for the returned data points. Valid values are: 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, or None.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_cloudwatch import mixins as cloudwatch_mixins metric_stat_property = cloudwatch_mixins.CfnAlarmPropsMixin.MetricStatProperty( metric=cloudwatch_mixins.CfnAlarmPropsMixin.MetricProperty( dimensions=[cloudwatch_mixins.CfnAlarmPropsMixin.DimensionProperty( name="name", value="value" )], metric_name="metricName", namespace="namespace" ), period=123, stat="stat", unit="unit" )
Attributes
- metric
The metric to return, including the metric name, namespace, and dimensions.
- period
The granularity, in seconds, of the returned data points.
For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 20, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a
PutMetricDatacall that includes aStorageResolutionof 1 second.If the
StartTimeparameter specifies a time stamp that is greater than 3 hours ago, you must specify the period as follows or no data points in that time range is returned:Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds (1 minute).
Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
- stat
The statistic to return.
It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in Statistics in the Amazon CloudWatch User Guide .
- unit
The unit to use for the returned data points.
Valid values are: 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, or None.