mirror of
https://github.com/storytold/terraform-aws-observability-accelerator.git
synced 2026-10-09 00:09:43 +00:00
9f0b90ab2f
* working module * metrics work * Add dynamic targets * dashboards and rules * readme and outputs * updating readme * Update scrape config - Drop unused go metrics - Drop empty labels - Add host, container and namespace labels * Update tags and query labels Co-authored-by: EC2 Default User <ec2-user@ip-172-31-9-72.us-west-2.compute.internal> Co-authored-by: Rodrigue Koffi <bonclay7@users.noreply.github.com>
44 lines
2.2 KiB
Terraform
44 lines
2.2 KiB
Terraform
# Prioritize recording rules over alerting rules for limits (10)
|
|
|
|
################################################################################################################################################
|
|
# Recording rules ##############################################################################################################################
|
|
################################################################################################################################################
|
|
|
|
resource "aws_prometheus_rule_group_namespace" "recording_rules" {
|
|
count = var.enable_recording_rules ? 1 : 0
|
|
name = "acclerator-nginx-rules"
|
|
workspace_id = var.managed_prometheus_workspace_id
|
|
data = <<EOF
|
|
groups:
|
|
- name: Nginx-HTTP-4xx-error-rate
|
|
rules:
|
|
- alert: metric:alerting_rule
|
|
expr: sum(rate(nginx_http_requests_total{status=~"^4.."}[1m])) / sum(rate(nginx_http_requests_total[1m])) * 100 > 5
|
|
for: 1m
|
|
labels:
|
|
severity: critical
|
|
annotations:
|
|
summary: Nginx high HTTP 4xx error rate (instance {{ $labels.instance }})
|
|
description: "Too many HTTP requests with status 4xx (> 5%)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
|
|
- name: Nginx-HTTP-5xx-error-rate
|
|
rules:
|
|
- alert: metric:alerting_rule
|
|
expr: sum(rate(nginx_http_requests_total{status=~"^5.."}[1m])) / sum(rate(nginx_http_requests_total[1m])) * 100 > 5
|
|
for: 1m
|
|
labels:
|
|
severity: critical
|
|
annotations:
|
|
summary: Nginx high HTTP 5xx error rate (instance {{ $labels.instance }})
|
|
description: "Too many HTTP requests with status 5xx (> 5%)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
|
|
- name: Nginx-high-latency
|
|
rules:
|
|
- alert: metric:alerting_rule
|
|
expr: histogram_quantile(0.99, sum(rate(nginx_http_request_duration_seconds_bucket[2m])) by (host, node)) > 3
|
|
for: 2m
|
|
labels:
|
|
severity: warning
|
|
annotations:
|
|
summary: Nginx latency high (instance {{ $labels.instance }})
|
|
description: "Nginx p99 latency is higher than 3 seconds\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
|
|
EOF
|
|
} |