aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2024-02-03 22:47:58 +0100
committerEgor Tensin <egor@tensin.name>2024-02-03 22:47:58 +0100
commit7ce1459f4a00805851fe36e87a489749e5f323a8 (patch)
treee2184c990f083147d1d3eecc01767ce114cbb165
parentsshd: minimize initial sshd_config (diff)
downloadinfra-terraform-1.1.0.tar.gz
infra-terraform-1.1.0.zip
digitalocean/server: customizable alerts w/ higher thresholdsv1.1.0
-rw-r--r--digitalocean/server/alerts.tf12
-rw-r--r--digitalocean/server/variables.tf17
2 files changed, 26 insertions, 3 deletions
diff --git a/digitalocean/server/alerts.tf b/digitalocean/server/alerts.tf
index e8a2c19..6667369 100644
--- a/digitalocean/server/alerts.tf
+++ b/digitalocean/server/alerts.tf
@@ -5,24 +5,30 @@ resource "digitalocean_monitor_alert" "cpu" {
alerts {
email = [data.digitalocean_account.this.email]
}
+
description = "CPU utilization on ${digitalocean_droplet.this.name}"
window = "5m"
type = "v1/insights/droplet/cpu"
compare = "GreaterThan"
- value = 70
+ value = var.alert_cpu_threshold
enabled = true
entities = [digitalocean_droplet.this.id]
+
+ count = var.alert_cpu_enable ? 1 : 0
}
-resource "digitalocean_monitor_alert" "load1" {
+resource "digitalocean_monitor_alert" "loadavg1" {
alerts {
email = [data.digitalocean_account.this.email]
}
+
description = "1-min load avg on ${digitalocean_droplet.this.name}"
window = "5m"
type = "v1/insights/droplet/load_1"
compare = "GreaterThan"
- value = 5
+ value = var.alert_loadavg1_threshold
enabled = true
entities = [digitalocean_droplet.this.id]
+
+ count = var.alert_loadavg1_enable ? 1 : 0
}
diff --git a/digitalocean/server/variables.tf b/digitalocean/server/variables.tf
index a3620fc..4912b78 100644
--- a/digitalocean/server/variables.tf
+++ b/digitalocean/server/variables.tf
@@ -38,3 +38,20 @@ variable "size" {
type = string
default = "s-1vcpu-2gb"
}
+
+variable "alert_cpu_enable" {
+ type = bool
+ default = true
+}
+variable "alert_cpu_threshold" {
+ type = number
+ default = 80
+}
+variable "alert_loadavg1_enable" {
+ type = bool
+ default = true
+}
+variable "alert_loadavg1_threshold" {
+ type = number
+ default = 5
+}