Skip to content

Commit

Permalink
Update main.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
vrglx33 authored Nov 7, 2024
1 parent 4b6f498 commit 3d3022b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tf/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,30 @@ resource "datadog_dashboard" "ec2_dashboard" {
}
}
}



# Crear una alerta en Datadog para el uso de CPU
resource "datadog_monitor" "cpu_usage_alert" {
name = "High CPU Utilization Alert"
type = "metric alert"
message = "La utilización de CPU ha superado el 80% durante más de 5 minutos. Por favor, revisa la instancia."
escalation_message = "La alerta de CPU sigue activa. Se requiere atención inmediata."

query = "avg(last_5m):avg:aws.ec2.cpuutilization{instance_id in (${join(",", data.aws_instances.all.ids)})} > 80"

# Configuración de notificaciones
notify_no_data = false
notify_audit = false
timeout_h = 0

# Configurar los umbrales del monitor
monitor_thresholds {
critical = 80
}

tags = [
"environment:production",
"team:operations"
]
}

0 comments on commit 3d3022b

Please sign in to comment.