front-integrations/terraform/alarms.tf

144 lines
4.7 KiB
Terraform
Raw Normal View History

resource "aws_cloudwatch_metric_alarm" "sla_monitor_errors" {
alarm_name = "front-sla-monitor-errors"
alarm_description = "front-sla-monitor invocation errors"
namespace = "AWS/Lambda"
metric_name = "Errors"
statistic = "Sum"
period = 300
evaluation_periods = 1
threshold = 0
comparison_operator = "GreaterThanThreshold"
treat_missing_data = "notBreaching"
alarm_actions = [var.alarm_sns_topic_arn]
dimensions = {
FunctionName = aws_lambda_function.sla_monitor.function_name
}
}
resource "aws_cloudwatch_metric_alarm" "sla_monitor_throttles" {
alarm_name = "front-sla-monitor-throttles"
alarm_description = "front-sla-monitor invocations throttled"
namespace = "AWS/Lambda"
metric_name = "Throttles"
statistic = "Sum"
period = 300
evaluation_periods = 1
threshold = 0
comparison_operator = "GreaterThanThreshold"
treat_missing_data = "notBreaching"
alarm_actions = [var.alarm_sns_topic_arn]
dimensions = {
FunctionName = aws_lambda_function.sla_monitor.function_name
}
}
resource "aws_cloudwatch_metric_alarm" "sla_monitor_duration" {
alarm_name = "front-sla-monitor-duration"
alarm_description = "front-sla-monitor approaching its 300s timeout (>90%)"
namespace = "AWS/Lambda"
metric_name = "Duration"
statistic = "Maximum"
period = 300
evaluation_periods = 1
threshold = 270000
comparison_operator = "GreaterThanThreshold"
treat_missing_data = "notBreaching"
alarm_actions = [var.alarm_sns_topic_arn]
dimensions = {
FunctionName = aws_lambda_function.sla_monitor.function_name
}
}
resource "aws_cloudwatch_metric_alarm" "user_sync_errors" {
alarm_name = "front-user-sync-errors"
alarm_description = "front-user-sync invocation errors"
namespace = "AWS/Lambda"
metric_name = "Errors"
statistic = "Sum"
period = 300
evaluation_periods = 1
threshold = 0
comparison_operator = "GreaterThanThreshold"
treat_missing_data = "notBreaching"
alarm_actions = [var.alarm_sns_topic_arn]
dimensions = {
FunctionName = aws_lambda_function.user_sync.function_name
}
}
resource "aws_cloudwatch_metric_alarm" "user_sync_throttles" {
alarm_name = "front-user-sync-throttles"
alarm_description = "front-user-sync invocations throttled"
namespace = "AWS/Lambda"
metric_name = "Throttles"
statistic = "Sum"
period = 300
evaluation_periods = 1
threshold = 0
comparison_operator = "GreaterThanThreshold"
treat_missing_data = "notBreaching"
alarm_actions = [var.alarm_sns_topic_arn]
dimensions = {
FunctionName = aws_lambda_function.user_sync.function_name
}
}
resource "aws_cloudwatch_metric_alarm" "user_sync_duration" {
alarm_name = "front-user-sync-duration"
alarm_description = "front-user-sync approaching its 300s timeout (>90%)"
namespace = "AWS/Lambda"
metric_name = "Duration"
statistic = "Maximum"
period = 300
evaluation_periods = 1
threshold = 270000
comparison_operator = "GreaterThanThreshold"
treat_missing_data = "notBreaching"
alarm_actions = [var.alarm_sns_topic_arn]
dimensions = {
FunctionName = aws_lambda_function.user_sync.function_name
}
}
resource "aws_cloudwatch_metric_alarm" "alerts_read_throttle" {
alarm_name = "front-sla-alerts-read-throttle"
alarm_description = "front-sla-alerts DynamoDB table had one or more read throttle events"
namespace = "AWS/DynamoDB"
metric_name = "ReadThrottleEvents"
statistic = "Sum"
period = 300
evaluation_periods = 1
threshold = 0
comparison_operator = "GreaterThanThreshold"
treat_missing_data = "notBreaching"
alarm_actions = [var.alarm_sns_topic_arn]
dimensions = {
TableName = aws_dynamodb_table.alerts.name
}
}
resource "aws_cloudwatch_metric_alarm" "alerts_write_throttle" {
alarm_name = "front-sla-alerts-write-throttle"
alarm_description = "front-sla-alerts DynamoDB table had one or more write throttle events"
namespace = "AWS/DynamoDB"
metric_name = "WriteThrottleEvents"
statistic = "Sum"
period = 300
evaluation_periods = 1
threshold = 0
comparison_operator = "GreaterThanThreshold"
treat_missing_data = "notBreaching"
alarm_actions = [var.alarm_sns_topic_arn]
dimensions = {
TableName = aws_dynamodb_table.alerts.name
}
}