MON-96 - Migrated system/linux monitors into system/generic
This commit is contained in:
parent
73d81d7053
commit
4fcbd5da7e
@ -98,7 +98,7 @@ EOF
|
|||||||
timeout_h = 0
|
timeout_h = 0
|
||||||
include_tags = true
|
include_tags = true
|
||||||
locked = false
|
locked = false
|
||||||
require_full_window = true
|
require_full_window = false
|
||||||
new_host_delay = "${var.evaluation_delay}"
|
new_host_delay = "${var.evaluation_delay}"
|
||||||
no_data_timeframe = 20
|
no_data_timeframe = 20
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
resource "datadog_monitor" "Apache_process" {
|
resource "datadog_monitor" "datadog_apache_process" {
|
||||||
name = "[${var.environment}] Apache process is down on {{host.name}}"
|
name = "[${var.environment}] Can't connect to apache, process is not running on {{host.name}}"
|
||||||
message = "${var.message}"
|
message = "${var.message}"
|
||||||
|
|
||||||
type = "service check"
|
type = "service check"
|
||||||
query = "\"apache.can_connect\".over(\"dd_monitoring:enabled\",\"dd_apache:enabled\",\"process:apache\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
query = "\"apache.can_connect\".over(\"dd_monitoring:enabled\",\"dd_apache:enabled\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
||||||
|
|
||||||
thresholds = {
|
thresholds = {
|
||||||
ok = 1
|
ok = 1
|
||||||
@ -22,5 +22,5 @@ resource "datadog_monitor" "Apache_process" {
|
|||||||
require_full_window = true
|
require_full_window = true
|
||||||
no_data_timeframe = 20
|
no_data_timeframe = 20
|
||||||
|
|
||||||
tags = ["env:${var.environment}", "type:resource"]
|
tags = ["env:${var.environment}", "resource:apache"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
resource "datadog_monitor" "Nginx_process" {
|
resource "datadog_monitor" "datadog_nginx_process" {
|
||||||
name = "[${var.environment}] Nginx process is down on {{host.name}}"
|
name = "[${var.environment}] Can't connect to nginx, process is not running on {{host.name}}"
|
||||||
message = "${var.message}"
|
message = "${var.message}"
|
||||||
|
|
||||||
type = "service check"
|
type = "service check"
|
||||||
query = "\"nginx.can_connect\".over(\"dd_monitoring:enabled\",\"dd_nginx:enabled\",\"process:nginx\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
query = "\"nginx.can_connect\".over(\"dd_monitoring:enabled\",\"dd_nginx:enabled\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
||||||
|
|
||||||
thresholds = {
|
thresholds = {
|
||||||
ok = 1
|
ok = 1
|
||||||
@ -22,5 +22,5 @@ resource "datadog_monitor" "Nginx_process" {
|
|||||||
require_full_window = true
|
require_full_window = true
|
||||||
no_data_timeframe = 20
|
no_data_timeframe = 20
|
||||||
|
|
||||||
tags = ["env:${var.environment}", "type:resource"]
|
tags = ["env:${var.environment}", "resource:nginx"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,11 @@ data "template_file" "filter" {
|
|||||||
template = "$${filter}"
|
template = "$${filter}"
|
||||||
|
|
||||||
vars {
|
vars {
|
||||||
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_aws_php_fpm:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_php_fpm:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "datadog_monitor" "php-fpm_process_idle" {
|
resource "datadog_monitor" "datadog_php_fpm_process_idle" {
|
||||||
name = "[${var.environment}] php_fpm busy worker {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
name = "[${var.environment}] php_fpm busy worker {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
||||||
message = "${var.message}"
|
message = "${var.message}"
|
||||||
|
|
||||||
@ -35,15 +35,15 @@ resource "datadog_monitor" "php-fpm_process_idle" {
|
|||||||
require_full_window = true
|
require_full_window = true
|
||||||
no_data_timeframe = 20
|
no_data_timeframe = 20
|
||||||
|
|
||||||
tags = ["env:${var.environment}", "type:resource"]
|
tags = ["env:${var.environment}", "resource:php-fpm"]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "datadog_monitor" "FPM_process" {
|
resource "datadog_monitor" "datadog_fpm_process" {
|
||||||
name = "[${var.environment}] FPM process is down on {{host.name}}"
|
name = "[${var.environment}] Can't ping FPM, process is not running on {{host.name}}"
|
||||||
message = "${var.message}"
|
message = "${var.message}"
|
||||||
|
|
||||||
type = "service check"
|
type = "service check"
|
||||||
query = "\"php_fpm.can_ping\".over(\"dd_monitoring:enabled\",\"dd_php_fpm:enabled\",\"process:php_fpm\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
query = "\"php_fpm.can_ping\".over(\"dd_monitoring:enabled\",\"dd_php_fpm:enabled\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
||||||
|
|
||||||
thresholds = {
|
thresholds = {
|
||||||
ok = 1
|
ok = 1
|
||||||
@ -62,5 +62,5 @@ resource "datadog_monitor" "FPM_process" {
|
|||||||
require_full_window = true
|
require_full_window = true
|
||||||
no_data_timeframe = 20
|
no_data_timeframe = 20
|
||||||
|
|
||||||
tags = ["env:${var.environment}", "type:resource"]
|
tags = ["env:${var.environment}", "resource:php-fpm"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,11 +24,17 @@ Inputs
|
|||||||
|
|
||||||
| Name | Description | Type | Default | Required |
|
| Name | Description | Type | Default | Required |
|
||||||
|------|-------------|:----:|:-----:|:-----:|
|
|------|-------------|:----:|:-----:|:-----:|
|
||||||
| custom_cpu_period | Set up period for the query | string | `last_5m` | no |
|
| cpu_high_threshold_critical | CPU high critical threshold | string | `95` | no |
|
||||||
| custom_cpu_threshold_critical | Custom CPU critical threshold | string | `95` | no |
|
| cpu_high_threshold_warning | CPU high warning threshold | string | `80` | no |
|
||||||
| custom_cpu_threshold_warning | Custom CPU warning threshold | string | `80` | no |
|
| cpu_high_timeframe | CPU high timeframe | string | `last_5m` | no |
|
||||||
| environment | Architecture Environment | string | - | yes |
|
| environment | Architecture Environment | string | - | yes |
|
||||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `600` | no |
|
| evaluation_delay | Delay in seconds for the metric evaluation | string | `600` | no |
|
||||||
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
|
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
|
||||||
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
||||||
|
| free_disk_inodes_threshold_critical | Free disk space critical threshold | string | `5` | no |
|
||||||
|
| free_disk_inodes_threshold_warning | Free disk space warning threshold | string | `10` | no |
|
||||||
|
| free_disk_space_threshold_critical | Free disk space critical threshold | string | `5` | no |
|
||||||
|
| free_disk_space_threshold_warning | Free disk space warning threshold | string | `10` | no |
|
||||||
|
| free_memory_threshold_critical | Free disk space critical threshold | string | `5` | no |
|
||||||
|
| free_memory_threshold_warning | Free disk space warning threshold | string | `10` | no |
|
||||||
| message | Message sent when an alert is triggered | string | - | yes |
|
| message | Message sent when an alert is triggered | string | - | yes |
|
||||||
|
|||||||
@ -26,17 +26,47 @@ variable "filter_tags_custom" {
|
|||||||
|
|
||||||
# Custom CPU instance specific
|
# Custom CPU instance specific
|
||||||
|
|
||||||
variable "custom_cpu_period" {
|
variable "cpu_high_timeframe" {
|
||||||
description = "Set up period for the query"
|
description = "CPU high timeframe"
|
||||||
default = "last_5m"
|
default = "last_5m"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "custom_cpu_threshold_warning" {
|
variable "cpu_high_threshold_warning" {
|
||||||
description = "Custom CPU warning threshold"
|
description = "CPU high warning threshold"
|
||||||
default = 80
|
default = 80
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "custom_cpu_threshold_critical" {
|
variable "cpu_high_threshold_critical" {
|
||||||
description = "Custom CPU critical threshold"
|
description = "CPU high critical threshold"
|
||||||
default = 95
|
default = 95
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "free_disk_space_threshold_warning" {
|
||||||
|
description = "Free disk space warning threshold"
|
||||||
|
default = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "free_disk_space_threshold_critical" {
|
||||||
|
description = "Free disk space critical threshold"
|
||||||
|
default = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "free_disk_inodes_threshold_warning" {
|
||||||
|
description = "Free disk space warning threshold"
|
||||||
|
default = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "free_disk_inodes_threshold_critical" {
|
||||||
|
description = "Free disk space critical threshold"
|
||||||
|
default = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "free_memory_threshold_warning" {
|
||||||
|
description = "Free disk space warning threshold"
|
||||||
|
default = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "free_memory_threshold_critical" {
|
||||||
|
description = "Free disk space critical threshold"
|
||||||
|
default = 5
|
||||||
|
}
|
||||||
|
|||||||
@ -6,24 +6,119 @@ data "template_file" "filter" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "datadog_monitor" "cpu_custom" {
|
resource "datadog_monitor" "datadog_cpu_too_high" {
|
||||||
name = "[${var.environment}] CPU too High {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
name = "[${var.environment}] CPU too High {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
||||||
message = "${var.message}"
|
message = "${var.message}"
|
||||||
|
|
||||||
query = <<EOF
|
query = <<EOF
|
||||||
min(${var.custom_cpu_period}): (
|
min(${var.cpu_high_timeframe}): (
|
||||||
avg:system.cpu.system{${data.template_file.filter.rendered}} by {region,host.name,host.ip} +
|
avg:system.cpu.system{${data.template_file.filter.rendered}} by {region,host} +
|
||||||
avg:system.cpu.user{${data.template_file.filter.rendered}} by {region,host.name,host.ip}
|
avg:system.cpu.user{${data.template_file.filter.rendered}} by {region,host}
|
||||||
) > ${var.custom_cpu_threshold_critical}"
|
) > ${var.cpu_high_threshold_critical}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
type = "metric alert"
|
type = "metric alert"
|
||||||
|
|
||||||
thresholds = {
|
thresholds {
|
||||||
warning = "${var.custom_cpu_threshold_warning}"
|
warning = "${var.cpu_high_threshold_warning}"
|
||||||
critical = "${var.custom_cpu_threshold_critical}"
|
critical = "${var.cpu_high_threshold_critical}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tags = ["env:${var.environment}", "type:system"]
|
||||||
|
|
||||||
|
notify_no_data = true
|
||||||
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
|
new_host_delay = "${var.evaluation_delay}"
|
||||||
|
notify_audit = false
|
||||||
|
timeout_h = 0
|
||||||
|
include_tags = true
|
||||||
|
locked = false
|
||||||
|
require_full_window = true
|
||||||
|
no_data_timeframe = 20
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "datadog_monitor" "datadog_free_disk_space_too_low" {
|
||||||
|
name = "[${var.environment}] Free disk space {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
||||||
|
message = "${var.message}"
|
||||||
|
|
||||||
|
query = <<EOF
|
||||||
|
sum(last_5m): (
|
||||||
|
avg:system.disk.free{${data.template_file.filter.rendered}} by {region,host,device} /
|
||||||
|
avg:system.disk.total{${data.template_file.filter.rendered}} by {region,host,device} * 100
|
||||||
|
) < ${var.free_disk_space_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type = "metric alert"
|
||||||
|
|
||||||
|
thresholds {
|
||||||
|
warning = "${var.free_disk_space_threshold_warning}"
|
||||||
|
critical = "${var.free_disk_space_threshold_critical}"
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = ["env:${var.environment}", "type:system"]
|
||||||
|
|
||||||
|
notify_no_data = true
|
||||||
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
|
new_host_delay = "${var.evaluation_delay}"
|
||||||
|
notify_audit = false
|
||||||
|
timeout_h = 0
|
||||||
|
include_tags = true
|
||||||
|
locked = false
|
||||||
|
require_full_window = true
|
||||||
|
no_data_timeframe = 20
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "datadog_monitor" "datadog_free_disk_space_inodes_too_low" {
|
||||||
|
name = "[${var.environment}] Free disk inodes {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
||||||
|
message = "${var.message}"
|
||||||
|
|
||||||
|
query = <<EOF
|
||||||
|
sum(last_5m): (
|
||||||
|
avg:system.fs.inodes.free{${data.template_file.filter.rendered}} by {region,host,device} /
|
||||||
|
avg:system.fs.inodes.total{${data.template_file.filter.rendered}} by {region,host,device} * 100
|
||||||
|
) < ${var.free_disk_inodes_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type = "metric alert"
|
||||||
|
|
||||||
|
thresholds {
|
||||||
|
warning = "${var.free_disk_inodes_threshold_warning}"
|
||||||
|
critical = "${var.free_disk_inodes_threshold_critical}"
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = ["env:${var.environment}", "type:system"]
|
||||||
|
|
||||||
|
notify_no_data = true
|
||||||
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
|
new_host_delay = "${var.evaluation_delay}"
|
||||||
|
notify_audit = false
|
||||||
|
timeout_h = 0
|
||||||
|
include_tags = true
|
||||||
|
locked = false
|
||||||
|
require_full_window = true
|
||||||
|
no_data_timeframe = 20
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "datadog_monitor" "datadog_free_memory" {
|
||||||
|
name = "[${var.environment}] Free memory {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
||||||
|
message = "Debugging alert - no escalation"
|
||||||
|
|
||||||
|
query = <<EOF
|
||||||
|
sum(last_1m): (
|
||||||
|
avg:system.mem.free{${data.template_file.filter.rendered}} by {region,host} /
|
||||||
|
avg:system.mem.total{${data.template_file.filter.rendered}} by {region,host} * 100
|
||||||
|
) < ${var.free_memory_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type = "metric alert"
|
||||||
|
|
||||||
|
thresholds {
|
||||||
|
warning = "${var.free_memory_threshold_warning}"
|
||||||
|
critical = "${var.free_memory_threshold_critical}"
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = ["env:${var.environment}", "type:system"]
|
||||||
|
|
||||||
notify_no_data = true
|
notify_no_data = true
|
||||||
evaluation_delay = "${var.evaluation_delay}"
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
new_host_delay = "${var.evaluation_delay}"
|
new_host_delay = "${var.evaluation_delay}"
|
||||||
|
|||||||
@ -1,43 +0,0 @@
|
|||||||
System Linux DataDog monitors
|
|
||||||
=============================
|
|
||||||
|
|
||||||
How to use this module
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
```
|
|
||||||
module "datadog-monitors-system-generic" {
|
|
||||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//system/linux?ref={revision}"
|
|
||||||
|
|
||||||
message = "${module.datadog-message-alerting.alerting-message}"
|
|
||||||
environment = "${var.environment}"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Purpose
|
|
||||||
-------
|
|
||||||
Creates a DataDog monitors with the following checks :
|
|
||||||
|
|
||||||
* System CPU High
|
|
||||||
* System Free disk space
|
|
||||||
* System Free disk inodes
|
|
||||||
* System Free memory
|
|
||||||
|
|
||||||
Inputs
|
|
||||||
------
|
|
||||||
|
|
||||||
| Name | Description | Type | Default | Required |
|
|
||||||
|------|-------------|:----:|:-----:|:-----:|
|
|
||||||
| cpu_high_threshold_critical | CPU high critical threshold | string | `95` | no |
|
|
||||||
| cpu_high_threshold_warning | CPU high warning threshold | string | `80` | no |
|
|
||||||
| custom_cpu_period | Set up period for the query | string | `last_5m` | no |
|
|
||||||
| environment | Architecture Environment | string | - | yes |
|
|
||||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `600` | no |
|
|
||||||
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
|
|
||||||
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
|
||||||
| free_disk_inodes_threshold_critical | Free disk space critical threshold | string | `5` | no |
|
|
||||||
| free_disk_inodes_threshold_warning | Free disk space warning threshold | string | `10` | no |
|
|
||||||
| free_disk_space_threshold_critical | Free disk space critical threshold | string | `5` | no |
|
|
||||||
| free_disk_space_threshold_warning | Free disk space warning threshold | string | `10` | no |
|
|
||||||
| free_memory_threshold_critical | Free disk space critical threshold | string | `5` | no |
|
|
||||||
| free_memory_threshold_warning | Free disk space warning threshold | string | `10` | no |
|
|
||||||
| message | Message sent when an alert is triggered | string | - | yes |
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
# Global Terraform
|
|
||||||
variable "environment" {
|
|
||||||
description = "Architecture Environment"
|
|
||||||
type = "string"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Global DataDog
|
|
||||||
variable "evaluation_delay" {
|
|
||||||
description = "Delay in seconds for the metric evaluation"
|
|
||||||
default = 600
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "message" {
|
|
||||||
description = "Message sent when an alert is triggered"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "filter_tags_use_defaults" {
|
|
||||||
description = "Use default filter tags convention"
|
|
||||||
default = "true"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "filter_tags_custom" {
|
|
||||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
|
||||||
default = "*"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Custom CPU instance specific
|
|
||||||
|
|
||||||
variable "custom_cpu_period" {
|
|
||||||
description = "Set up period for the query"
|
|
||||||
default = "last_5m"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "cpu_high_threshold_warning" {
|
|
||||||
description = "CPU high warning threshold"
|
|
||||||
default = 80
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "cpu_high_threshold_critical" {
|
|
||||||
description = "CPU high critical threshold"
|
|
||||||
default = 95
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "free_disk_space_threshold_warning" {
|
|
||||||
description = "Free disk space warning threshold"
|
|
||||||
default = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "free_disk_space_threshold_critical" {
|
|
||||||
description = "Free disk space critical threshold"
|
|
||||||
default = 5
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "free_disk_inodes_threshold_warning" {
|
|
||||||
description = "Free disk space warning threshold"
|
|
||||||
default = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "free_disk_inodes_threshold_critical" {
|
|
||||||
description = "Free disk space critical threshold"
|
|
||||||
default = 5
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "free_memory_threshold_warning" {
|
|
||||||
description = "Free disk space warning threshold"
|
|
||||||
default = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "free_memory_threshold_critical" {
|
|
||||||
description = "Free disk space critical threshold"
|
|
||||||
default = 5
|
|
||||||
}
|
|
||||||
@ -1,178 +0,0 @@
|
|||||||
data "template_file" "filter" {
|
|
||||||
template = "$${filter}"
|
|
||||||
|
|
||||||
vars {
|
|
||||||
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_aws_linux:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "datadog_monitor" "datadog_cpu_too_high" {
|
|
||||||
name = "[${var.environment}] CPU High {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
|
||||||
message = "${var.message}"
|
|
||||||
|
|
||||||
query = <<EOF
|
|
||||||
min(last_15m): (
|
|
||||||
avg:system.cpu.system{${data.template_file.filter.rendered}} by {region,host} +
|
|
||||||
avg:system.cpu.user{${data.template_file.filter.rendered}} by {region,host}
|
|
||||||
) > ${var.cpu_high_threshold_critical}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
type = "metric alert"
|
|
||||||
|
|
||||||
thresholds {
|
|
||||||
warning = "${var.cpu_high_threshold_warning}"
|
|
||||||
critical = "${var.cpu_high_threshold_critical}"
|
|
||||||
}
|
|
||||||
|
|
||||||
tags = ["env:${var.environment}", "type:system"]
|
|
||||||
|
|
||||||
notify_no_data = true
|
|
||||||
evaluation_delay = "${var.evaluation_delay}"
|
|
||||||
new_host_delay = "${var.evaluation_delay}"
|
|
||||||
notify_audit = false
|
|
||||||
timeout_h = 0
|
|
||||||
include_tags = true
|
|
||||||
locked = false
|
|
||||||
require_full_window = true
|
|
||||||
no_data_timeframe = 20
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "datadog_monitor" "datadog_free_disk_space_too_low" {
|
|
||||||
name = "[${var.environment}] Free disk space {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
|
||||||
message = "${var.message}"
|
|
||||||
|
|
||||||
query = <<EOF
|
|
||||||
sum(last_5m): (
|
|
||||||
avg:system.disk.free{${data.template_file.filter.rendered}} by {region,host,device} /
|
|
||||||
avg:system.disk.total{${data.template_file.filter.rendered}} by {region,host,device} * 100
|
|
||||||
) < ${var.free_disk_space_threshold_critical}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
type = "metric alert"
|
|
||||||
|
|
||||||
thresholds {
|
|
||||||
warning = "${var.free_disk_space_threshold_warning}"
|
|
||||||
critical = "${var.free_disk_space_threshold_critical}"
|
|
||||||
}
|
|
||||||
|
|
||||||
tags = ["env:${var.environment}", "type:system"]
|
|
||||||
|
|
||||||
notify_no_data = true
|
|
||||||
evaluation_delay = "${var.evaluation_delay}"
|
|
||||||
new_host_delay = "${var.evaluation_delay}"
|
|
||||||
notify_audit = false
|
|
||||||
timeout_h = 0
|
|
||||||
include_tags = true
|
|
||||||
locked = false
|
|
||||||
require_full_window = true
|
|
||||||
no_data_timeframe = 20
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "datadog_monitor" "datadog_free_disk_space_inodes_too_low" {
|
|
||||||
name = "[${var.environment}] Free disk inodes {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
|
||||||
message = "${var.message}"
|
|
||||||
|
|
||||||
query = <<EOF
|
|
||||||
sum(last_5m): (
|
|
||||||
avg:system.fs.inodes.free{${data.template_file.filter.rendered}} by {region,host,device} /
|
|
||||||
avg:system.fs.inodes.total{${data.template_file.filter.rendered}} by {region,host,device} * 100
|
|
||||||
) < ${var.free_disk_inodes_threshold_critical}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
type = "metric alert"
|
|
||||||
|
|
||||||
thresholds {
|
|
||||||
warning = "${var.free_disk_inodes_threshold_warning}"
|
|
||||||
critical = "${var.free_disk_inodes_threshold_critical}"
|
|
||||||
}
|
|
||||||
|
|
||||||
tags = ["env:${var.environment}", "type:system"]
|
|
||||||
|
|
||||||
notify_no_data = true
|
|
||||||
evaluation_delay = "${var.evaluation_delay}"
|
|
||||||
new_host_delay = "${var.evaluation_delay}"
|
|
||||||
notify_audit = false
|
|
||||||
timeout_h = 0
|
|
||||||
include_tags = true
|
|
||||||
locked = false
|
|
||||||
require_full_window = true
|
|
||||||
no_data_timeframe = 20
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "datadog_monitor" "datadog_free_memory" {
|
|
||||||
name = "[${var.environment}] Free memory {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
|
|
||||||
message = "Debugging alert - no escalation"
|
|
||||||
|
|
||||||
query = <<EOF
|
|
||||||
sum(last_1m): (
|
|
||||||
avg:system.mem.free{${data.template_file.filter.rendered}} by {region,host} /
|
|
||||||
avg:system.mem.total{${data.template_file.filter.rendered}} by {region,host} * 100
|
|
||||||
) < ${var.free_memory_threshold_critical}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
type = "metric alert"
|
|
||||||
|
|
||||||
thresholds {
|
|
||||||
warning = "${var.free_memory_threshold_warning}"
|
|
||||||
critical = "${var.free_memory_threshold_critical}"
|
|
||||||
}
|
|
||||||
|
|
||||||
tags = ["env:${var.environment}", "type:system"]
|
|
||||||
|
|
||||||
notify_no_data = true
|
|
||||||
evaluation_delay = "${var.evaluation_delay}"
|
|
||||||
new_host_delay = "${var.evaluation_delay}"
|
|
||||||
renotify_interval = 0
|
|
||||||
notify_audit = false
|
|
||||||
timeout_h = 0
|
|
||||||
include_tags = true
|
|
||||||
locked = false
|
|
||||||
require_full_window = true
|
|
||||||
no_data_timeframe = 20
|
|
||||||
}
|
|
||||||
|
|
||||||
# resource "datadog_monitor" "datadog_cpu_load" {
|
|
||||||
# name = "CPU Load > 2"
|
|
||||||
# message = "Debugging alert - no escalation"
|
|
||||||
|
|
||||||
|
|
||||||
# query = "min(last_5m):avg:system.load.5{dd_monitoring:enabled,dd_linux_basics:enabled,!dd_custom_cpu:enabled} by {instance-id} / avg:gcp.gce.instance.cpu.reserved_cores{*} by {instance-id} > 2"
|
|
||||||
# type = "query alert"
|
|
||||||
# count = "${var.dd_linux_basics == "enabled" ? 1 : 0}"
|
|
||||||
|
|
||||||
|
|
||||||
# notify_no_data = "${var.linux_basics_config["notify_no_data"]}"
|
|
||||||
# evaluation_delay = "${var.linux_basics_config["delay"]}"
|
|
||||||
# new_host_delay = "${var.linux_basics_config["delay"]}"
|
|
||||||
# renotify_interval = 60
|
|
||||||
# notify_audit = false
|
|
||||||
# timeout_h = 0
|
|
||||||
# include_tags = true
|
|
||||||
# locked = false
|
|
||||||
# require_full_window = true
|
|
||||||
# no_data_timeframe = 20
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
# resource "datadog_monitor" "datadog_host_unreachable" {
|
|
||||||
# name = "Host unreachable"
|
|
||||||
# message = "{{#is_alert}}\n${var.hno_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.hno_escalation_group} \n{{/is_recovery}}"
|
|
||||||
|
|
||||||
|
|
||||||
# query = "datadog.agent.up.over(dd_monitoring:enabled,dd_linux_basics:enabled,env:${var.env},!dd_custom_cpu:enabled).last(1).count_by_status()"
|
|
||||||
# type = "service check"
|
|
||||||
# count = "${var.dd_linux_basics == "enabled" ? 1 : 0}"
|
|
||||||
|
|
||||||
|
|
||||||
# notify_no_data = "${var.linux_basics_config["notify_no_data"]}"
|
|
||||||
# evaluation_delay = "${var.linux_basics_config["delay"]}"
|
|
||||||
# new_host_delay = "${var.linux_basics_config["delay"]}"
|
|
||||||
# renotify_interval = 60
|
|
||||||
# notify_audit = false
|
|
||||||
# timeout_h = 0
|
|
||||||
# include_tags = true
|
|
||||||
# locked = false
|
|
||||||
# require_full_window = true
|
|
||||||
# no_data_timeframe = 20
|
|
||||||
# }
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user