Difference between revisions of "Aws cloudwatch metric alarm"

From wikieduonline
Jump to navigation Jump to search
Tag: New redirect
 
Line 1: Line 1:
{{lowercase}}
+
#redirect [[Terraform resource: aws_cloudwatch_metric_alarm]]
 
 
* <code>[[aws cloudwatch metric]] [[alarm]]</code>
 
 
 
 
 
== ChatGPT examples (01/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_cloudwatch_metric_alarm" "elb_response_time" {
 
  alarm_name                = "elb_response_time"
 
  comparison_operator      = "GreaterThanThreshold"
 
  evaluation_periods        = "5"
 
  metric_name              = "[[TargetResponseTime]]"
 
  namespace                = "AWS/ApplicationELB"
 
  period                    = "60"
 
  statistic                = "[[Average]]"
 
  threshold                = "2"
 
  alarm_description        = "This alarm will notify when the average response time is greater than 2 seconds for 5 consecutive data points"
 
  alarm_actions            = [aws_sns_topic.example.arn]
 
  dimensions = {
 
    LoadBalancer = aws_elbv2_load_balancer.example.name
 
  }
 
}
 
 
 
resource "aws_cloudwatch_metric_alarm" "elb_response_time" {
 
  alarm_name                = "elb_response_time"
 
  comparison_operator      = "GreaterThanThreshold"
 
  evaluation_periods        = "5"
 
  metric_name              = "[[TargetResponseTime]]"
 
  namespace                = "AWS/ApplicationELB"
 
  period                    = "60"
 
  statistic                = "[[Maximum]]"
 
  threshold                = "1"
 
  alarm_description        = "This alarm will notify when the maximum response time is greater than 1 second for 5 consecutive data points"
 
  alarm_actions            = [aws_sns_topic.example.arn]
 
  dimensions = {
 
    LoadBalancer = aws_elbv2_load_balancer.example.name
 
  }
 
}
 
 
 
resource "aws_cloudwatch_metric_alarm" "elb_response_time_90th_percentile" {
 
  alarm_name                = "elb_response_time_90th_percentile"
 
  comparison_operator      = "GreaterThanThreshold"
 
  evaluation_periods        = "5"
 
  metric_name              = "TargetResponseTime"
 
  namespace                = "AWS/ApplicationELB"
 
  period                    = "60"
 
  statistic                = "p90"
 
  threshold                = "1"
 
  alarm_description        = "This alarm will notify when the 90th percentile of the response time is greater than 1 second for 5 consecutive data points"
 
  alarm_actions            = [aws_sns_topic.example.arn]
 
  dimensions = {
 
    LoadBalancer = aws_elbv2_load_balancer.example.name
 
  }
 
}
 
 
 
 
 
 
 
 
 
resource "[[aws_sns_topic]]" "example" {
 
  name = "example-topic"
 
}
 
 
 
 
 
 
 
* [[Terraform resource: aws_cloudwatch_metric_alarm]]
 
 
 
== See also ==
 
* {{aws cloudwatch}}
 
 
 
 
 
[[Category:AWS]]
 

Latest revision as of 14:23, 31 January 2023

Advertising: