aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/digitalocean/server/alerts.tf
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-08-04 14:18:08 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-08-04 14:18:08 +0200
commit15b9dea7a95765f1f3c09fe0dcb2ea5b5cb669c1 (patch)
treec0c192e00c419ade1779ae62b3aed91bbb3e8778 /digitalocean/server/alerts.tf
parentinitial commit (diff)
downloadinfra-terraform-15b9dea7a95765f1f3c09fe0dcb2ea5b5cb669c1.tar.gz
infra-terraform-15b9dea7a95765f1f3c09fe0dcb2ea5b5cb669c1.zip
import some common modulesv0.0.1
Diffstat (limited to 'digitalocean/server/alerts.tf')
-rw-r--r--digitalocean/server/alerts.tf28
1 files changed, 28 insertions, 0 deletions
diff --git a/digitalocean/server/alerts.tf b/digitalocean/server/alerts.tf
new file mode 100644
index 0000000..e8a2c19
--- /dev/null
+++ b/digitalocean/server/alerts.tf
@@ -0,0 +1,28 @@
+data "digitalocean_account" "this" {
+}
+
+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
+ enabled = true
+ entities = [digitalocean_droplet.this.id]
+}
+
+resource "digitalocean_monitor_alert" "load1" {
+ 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
+ enabled = true
+ entities = [digitalocean_droplet.this.id]
+}