Skip to content

Instantly share code, notes, and snippets.

@theawesomenayak
Last active December 26, 2020 15:20
Show Gist options
  • Save theawesomenayak/249a5e2d1f49a15b3d9e8316da30d805 to your computer and use it in GitHub Desktop.
Save theawesomenayak/249a5e2d1f49a15b3d9e8316da30d805 to your computer and use it in GitHub Desktop.
resource "wavefront_alert_target" "ec2_alert_target" {
name = "EC2 Alert Target"
method = "EMAIL"
recipient = "test@example.com"
email_subject = "EC2 threshold has been breached"
is_html_content = true
template = "{}"
triggers = [
"ALERT_OPENED",
"ALERT_RESOLVED"
]
}
resource "wavefront_alert" "cpu_utilization_alert" {
name = "CPU Utilization Alert"
alert_type = "THRESHOLD"
minutes = 5
resolve_after_minutes = 5
display_expression = "ts(aws.ec2.cpu.utilization, environment=prod)"
conditions = {
"severe" = "ts(aws.ec2.cpu.utilization, environment=prod) > 80"
"warn" = "ts(aws.ec2.cpu.utilization, environment=prod) > 60"
}
threshold_targets = {
"severe" = "target:${wavefront_alert_target.ec2_alert_target.id}"
"warn" = "target:${wavefront_alert_target.ec2_alert_target.id}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment