AlarmProps Struct
Properties for Alarms.
Example
ts
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
actionsEnabledbooleanactions_enabledboolactionsEnabledBooleanActionsEnabledboolActionsEnabled*bool= true#Whether the actions for this alarm are enabled.
alarmDescriptionstringalarm_descriptionstralarmDescriptionStringAlarmDescriptionstringAlarmDescription*string#Description for the alarm.
Default: No description
Name of the alarm.
Default: Automatically generated name
comparisonOperatorComparisonOperatorcomparison_operatorComparisonOperatorcomparisonOperatorComparisonOperatorComparisonOperatorComparisonOperatorComparisonOperatorComparisonOperator= GreaterThanOrEqualToThreshold#Comparison to use to check if metric is breaching.
datapointsToAlarmnumberdatapoints_to_alarmint | floatdatapointsToAlarmNumberDatapointsToAlarmdoubleDatapointsToAlarm*float64= ``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.
evaluateLowSampleCountPercentilestringevaluate_low_sample_count_percentilestrevaluateLowSampleCountPercentileStringEvaluateLowSampleCountPercentilestringEvaluateLowSampleCountPercentile*string#Specifies whether to evaluate the data and potentially change the alarm state if there are too few data points to be statistically significant.
Default: Not configured.
Used only for alarms that are based on percentiles.
evaluationPeriodsnumberevaluation_periodsint | floatevaluationPeriodsNumberEvaluationPeriodsdoubleEvaluationPeriods*float64required#The number of periods over which data is compared to the specified threshold.
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.
The value against which the specified statistic is compared.
treatMissingDataTreatMissingDatatreat_missing_dataTreatMissingDatatreatMissingDataTreatMissingDataTreatMissingDataTreatMissingDataTreatMissingDataTreatMissingData= TreatMissingData.Missing#Sets how this alarm is to handle missing data points.