Difference between revisions of "Aws cloudwatch metric alarm"

From wikieduonline
Jump to navigation Jump to search
Line 2: Line 2:
  
 
* <code>[[aws cloudwatch metric]] [[alarm]]</code>
 
* <code>[[aws cloudwatch metric]] [[alarm]]</code>
 +
 +
resource "aws_cloudwatch_metric_alarm" "elb_5xx_error_rate" {
 +
  alarm_name                = "elb_5xx_error_rate"
 +
  comparison_operator      = "GreaterThanThreshold"
 +
  evaluation_periods        = "5"
 +
  metric_name              = "HTTPCode_Backend_5XX"
 +
  namespace                = "AWS/ApplicationELB"
 +
  period                    = "60"
 +
  statistic                = "SampleCount"
 +
  threshold                = "1"
 +
  alarm_description        = "This alarm will notify when the 5XX error rate is greater than 1% for 5 consecutive minutes"
 +
  alarm_actions            = [aws_sns_topic.example.arn]
 +
  dimensions = {
 +
    LoadBalancer = aws_elbv2_load_balancer.example.name
 +
  }
 +
}
 +
 +
resource "aws_sns_topic" "example" {
 +
  name = "example-topic"
 +
}
 +
  
  

Revision as of 09:39, 23 January 2023

resource "aws_cloudwatch_metric_alarm" "elb_5xx_error_rate" {
 alarm_name                = "elb_5xx_error_rate"
 comparison_operator       = "GreaterThanThreshold"
 evaluation_periods        = "5"
 metric_name               = "HTTPCode_Backend_5XX"
 namespace                 = "AWS/ApplicationELB"
 period                    = "60"
 statistic                 = "SampleCount"
 threshold                 = "1"
 alarm_description         = "This alarm will notify when the 5XX error rate is greater than 1% for 5 consecutive minutes"
 alarm_actions             = [aws_sns_topic.example.arn]
 dimensions = {
   LoadBalancer = aws_elbv2_load_balancer.example.name
 }
}
resource "aws_sns_topic" "example" {
 name = "example-topic"
}


See also

Advertising: