# Monitor CPU Utilisation resource "datadog_monitor" "cpumonitor" { name = "cpu monitor" type = "metric alert" message = "CPU usage alert" query = "avg(last_1m):avg:system.cpu.system{*} by {host} > 60" monitor_thresholds { ok = 20 warning = 50 critical = 60 } } # Monitor Memory Utilisation resource "datadog_monitor" "memorymonitor" { name = "Usable Memory" type = "query alert" evaluation_delay = "15" include_tags = true locked = false message = "Plaaper de plaaper de plaap" new_host_delay = 300 no_data_timeframe = 0 #notify_audit = 0 #notify_no_data = 0 priority = 0 renotify_interval = 0 require_full_window = true #restricted_roles = [] timeout_h = 0 query = "max(last_5m):avg:system.mem.usable{*} by {host} / avg:system.mem.total{*} by {host} * 100 < 5" monitor_thresholds { critical = 5 warning = 10 } } # Monitor System Load resource "datadog_monitor" "systemload" { name = "System Load" type = "query alert" evaluation_delay = "15" include_tags = true locked = false new_host_delay = 300 no_data_timeframe = 0 #notify_audit = false priority = 0 renotify_interval = 0 require_full_window = true #restricted_roles = [] tags = [] timeout_h = 0 message = "System Load exceeding set Thresholg, please investigate" query = "min(last_30m):( avg:system.load.norm.5{*} by {host} ) > 2.5" monitor_thresholds { critical = "2.5" warning = "2" } } # Monitor Disk Utilisation resource "datadog_monitor" "disk_usage" { name = "Disk Space" type = "query alert" evaluation_delay = 15 include_tags = true locked = false new_host_delay = 300 no_data_timeframe = 0 #notify_audit = 0 priority = 0 renotify_interval = 0 require_full_window = true #restricted_roles = [] tags = [] timeout_h = 0 message = "Disk Usage is exceeding set threshold, please investigate" query = "max(last_5m):avg:system.disk.in_use{*} by {host,device} * 100 > 90" monitor_thresholds { critical = "90" warning = "80" } } # Monitor Disk Inode Usage resource "datadog_monitor" "disk_inodes" { name = "Disk Inodes Usage" type = "query alert" evaluation_delay = 15 include_tags = true locked = false new_host_delay = 300 no_data_timeframe = 0 #notify_audit = 0 priority = 0 renotify_interval = 0 require_full_window = true #restricted_roles = [] tags = [] timeout_h = 0 message = "Disk Inode Usage is exceeding set threshold, please investigate" query = "min(last_5m):avg:system.fs.inodes.in_use{*} by {host,device} * 100 > 95" monitor_thresholds { critical = "95" warning = "90" } } # Monitor Disk Space Forecast resource "datadog_monitor" "disk_forecast" { name = "Disk Usage Forecast" type = "query alert" evaluation_delay = 15 include_tags = true locked = false new_host_delay = 300 no_data_timeframe = 0 #notify_audit = 0 priority = 0 renotify_interval = 0 require_full_window = true #restricted_roles = [] tags = [] timeout_h = 0 message = "Disk Usage is exceeding set threshold, please investigate" query = "max(next_1w):forecast(avg:system.disk.in_use{*} by {host,device} * 100, 'linear', 1, interval='60m', history='1w', model='default') >= 80" monitor_thresholds { critical = "80" warning = "72" } }