interface AlarmProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudWatch.AlarmProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#AlarmProps |
Java | software.amazon.awscdk.services.cloudwatch.AlarmProps |
Python | aws_cdk.aws_cloudwatch.AlarmProps |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch » AlarmProps |
Properties for Alarms.
Example
declare const logGroup: logs.LogGroup;
const mf = new logs.MetricFilter(this, 'MetricFilter', {
logGroup,
metricNamespace: 'MyApp',
metricName: 'Latency',
filterPattern: logs.FilterPattern.exists('$.latency'),
metricValue: '$.latency',
dimensions: {
ErrorCode: '$.errorCode',
},
unit: cloudwatch.Unit.MILLISECONDS,
});
//expose a metric from the metric filter
const metric = mf.metric();
//you can use the metric to create a new alarm
new cloudwatch.Alarm(this, 'alarm from metric filter', {
metric,
threshold: 100,
evaluationPeriods: 2,
});
Properties
Name | Type | Description |
---|---|---|
evaluation | number | The number of periods over which data is compared to the specified threshold. |
metric | IMetric | The metric to add the alarm on. |
threshold | number | The value against which the specified statistic is compared. |
actions | boolean | Whether the actions for this alarm are enabled. |
alarm | string | Description for the alarm. |
alarm | string | Name of the alarm. |
comparison | Comparison | Comparison to use to check if metric is breaching. |
datapoints | number | The number of datapoints that must be breaching to trigger the alarm. |
evaluate | string | Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant. |
treat | Treat | Sets how this alarm is to handle missing data points. |
evaluationPeriods
Type:
number
The number of periods over which data is compared to the specified threshold.
metric
Type:
IMetric
The metric to add the alarm on.
Metric objects can be obtained from most resources, or you can construct custom Metric objects by instantiating one.
threshold
Type:
number
The value against which the specified statistic is compared.
actionsEnabled?
Type:
boolean
(optional, default: true)
Whether the actions for this alarm are enabled.
alarmDescription?
Type:
string
(optional, default: No description)
Description for the alarm.
alarmName?
Type:
string
(optional, default: Automatically generated name)
Name of the alarm.
comparisonOperator?
Type:
Comparison
(optional, default: GreaterThanOrEqualToThreshold)
Comparison to use to check if metric is breaching.
datapointsToAlarm?
Type:
number
(optional, default: evaluationPeriods
)
The number of datapoints that must be breaching to trigger the alarm.
This is used only if you are setting an "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.
evaluateLowSampleCountPercentile?
Type:
string
(optional, default: Not configured.)
Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant.
Used only for alarms that are based on percentiles.
treatMissingData?
Type:
Treat
(optional, default: TreatMissingData.Missing)
Sets how this alarm is to handle missing data points.