Merged in MON-286-host-unreachable-monitor-on-syst (pull request #134)
MON-286 add host unreachable monitor to system generic Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr> Approved-by: Rafael Romero Carmona <rafael.romero.carmona@fr.clara.net> Approved-by: Alexandre Gaillet <alexandre.gaillet@fr.clara.net>
This commit is contained in:
commit
f88ef9efba
@ -16,6 +16,7 @@ module "datadog-monitors-system-generic" {
|
|||||||
|
|
||||||
Creates DataDog monitors with the following checks:
|
Creates DataDog monitors with the following checks:
|
||||||
|
|
||||||
|
- Host unreachable
|
||||||
- CPU usage
|
- CPU usage
|
||||||
- CPU load 5
|
- CPU load 5
|
||||||
- Free disk space
|
- Free disk space
|
||||||
@ -81,6 +82,10 @@ Creates DataDog monitors with the following checks:
|
|||||||
| free_memory_timeframe | Monitor timeframe for Free memory [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_5m` | no |
|
| free_memory_timeframe | Monitor timeframe for Free memory [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_5m` | no |
|
||||||
| message | Message sent when an alert is triggered | string | - | yes |
|
| message | Message sent when an alert is triggered | string | - | yes |
|
||||||
| new_host_delay | Delay in seconds before monitor new resource | string | `300` | no |
|
| new_host_delay | Delay in seconds before monitor new resource | string | `300` | no |
|
||||||
|
| unreachable_extra_tags | Extra tags for Host unreachable monitor | list | `<list>` | no |
|
||||||
|
| unreachable_message | Custom message for Host unreachable monitor | string | `` | no |
|
||||||
|
| unreachable_no_data_timeframe | Timeframe for Host unreachable monitor to alert on no data | string | `2` | no |
|
||||||
|
| unreachable_silenced | Groups to mute for Host unreachable monitor | map | `<map>` | no |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
@ -91,6 +96,7 @@ Creates DataDog monitors with the following checks:
|
|||||||
| datadog_free_disk_space_inodes_too_low_id | id for monitor datadog_free_disk_space_inodes_too_low |
|
| datadog_free_disk_space_inodes_too_low_id | id for monitor datadog_free_disk_space_inodes_too_low |
|
||||||
| datadog_free_disk_space_too_low_id | id for monitor datadog_free_disk_space_too_low |
|
| datadog_free_disk_space_too_low_id | id for monitor datadog_free_disk_space_too_low |
|
||||||
| datadog_free_memory_id | id for monitor datadog_free_memory |
|
| datadog_free_memory_id | id for monitor datadog_free_memory |
|
||||||
|
| datadog_host_unreachable_id | id for monitor datadog_host_unreachable |
|
||||||
| datadog_load_too_high_id | id for monitor datadog_load_too_high |
|
| datadog_load_too_high_id | id for monitor datadog_load_too_high |
|
||||||
|
|
||||||
## Related documentation
|
## Related documentation
|
||||||
|
|||||||
@ -29,7 +29,31 @@ variable "filter_tags_custom" {
|
|||||||
default = "*"
|
default = "*"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Custom CPU instance specific
|
# System generic specific
|
||||||
|
|
||||||
|
variable "unreachable_silenced" {
|
||||||
|
description = "Groups to mute for Host unreachable monitor"
|
||||||
|
type = "map"
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "unreachable_extra_tags" {
|
||||||
|
description = "Extra tags for Host unreachable monitor"
|
||||||
|
type = "list"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "unreachable_message" {
|
||||||
|
description = "Custom message for Host unreachable monitor"
|
||||||
|
type = "string"
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "unreachable_no_data_timeframe" {
|
||||||
|
description = "Timeframe for Host unreachable monitor to alert on no data"
|
||||||
|
type = "string"
|
||||||
|
default = 2
|
||||||
|
}
|
||||||
|
|
||||||
variable "cpu_high_silenced" {
|
variable "cpu_high_silenced" {
|
||||||
description = "Groups to mute for CPU high monitor"
|
description = "Groups to mute for CPU high monitor"
|
||||||
|
|||||||
@ -2,7 +2,7 @@ module "filter-tags" {
|
|||||||
source = "../../common/filter-tags"
|
source = "../../common/filter-tags"
|
||||||
|
|
||||||
environment = "${var.environment}"
|
environment = "${var.environment}"
|
||||||
resource = "generic"
|
resource = "system"
|
||||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||||
filter_tags_custom = "${var.filter_tags_custom}"
|
filter_tags_custom = "${var.filter_tags_custom}"
|
||||||
}
|
}
|
||||||
@ -11,7 +11,7 @@ module "filter-tags-disk" {
|
|||||||
source = "../../common/filter-tags"
|
source = "../../common/filter-tags"
|
||||||
|
|
||||||
environment = "${var.environment}"
|
environment = "${var.environment}"
|
||||||
resource = "generic"
|
resource = "system"
|
||||||
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
|
||||||
filter_tags_custom = "${var.filter_tags_custom}"
|
filter_tags_custom = "${var.filter_tags_custom}"
|
||||||
extra_tags = ["dd_disk:enabled"]
|
extra_tags = ["dd_disk:enabled"]
|
||||||
|
|||||||
@ -1,3 +1,31 @@
|
|||||||
|
resource "datadog_monitor" "datadog_host_unreachable" {
|
||||||
|
name = "[${var.environment}] Host unreachable"
|
||||||
|
message = "${coalesce(var.unreachable_message, var.message)}"
|
||||||
|
|
||||||
|
query = "\"datadog.agent.up\".over${module.filter-tags.service_check}.last(6).count_by_status()"
|
||||||
|
|
||||||
|
type = "service check"
|
||||||
|
|
||||||
|
thresholds {
|
||||||
|
ok = 1
|
||||||
|
warning = 1
|
||||||
|
critical = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_no_data = true
|
||||||
|
new_host_delay = "${var.new_host_delay}"
|
||||||
|
notify_audit = false
|
||||||
|
timeout_h = 0
|
||||||
|
include_tags = true
|
||||||
|
locked = false
|
||||||
|
require_full_window = true
|
||||||
|
no_data_timeframe = "${var.unreachable_no_data_timeframe}"
|
||||||
|
|
||||||
|
silenced = "${var.unreachable_silenced}"
|
||||||
|
|
||||||
|
tags = ["env:${var.environment}", "type:system", "provider:host", "resource:generic", "team:claranet", "created-by:terraform", "${var.unreachable_extra_tags}"]
|
||||||
|
}
|
||||||
|
|
||||||
resource "datadog_monitor" "datadog_cpu_too_high" {
|
resource "datadog_monitor" "datadog_cpu_too_high" {
|
||||||
name = "[${var.environment}] CPU usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
|
name = "[${var.environment}] CPU usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
|
||||||
message = "${coalesce(var.cpu_high_message, var.message)}"
|
message = "${coalesce(var.cpu_high_message, var.message)}"
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
output "datadog_host_unreachable_id" {
|
||||||
|
description = "id for monitor datadog_host_unreachable"
|
||||||
|
value = "${datadog_monitor.datadog_host_unreachable.id}"
|
||||||
|
}
|
||||||
|
|
||||||
output "datadog_cpu_too_high_id" {
|
output "datadog_cpu_too_high_id" {
|
||||||
description = "id for monitor datadog_cpu_too_high"
|
description = "id for monitor datadog_cpu_too_high"
|
||||||
value = "${datadog_monitor.datadog_cpu_too_high.id}"
|
value = "${datadog_monitor.datadog_cpu_too_high.id}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user