generated from kabisa/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpu-usage.tf
38 lines (33 loc) · 1.4 KB
/
cpu-usage.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
locals {
cpu_usage_filter = coalesce(
var.cpu_usage_filter_override,
var.filter_str
)
}
module "cpu_usage" {
source = "kabisa/generic-monitor/datadog"
version = "1.0.0"
name = "Container - CPU usage"
query = "avg(${var.cpu_usage_evaluation_period}):avg:docker.cpu.usage{${local.cpu_usage_filter}} by {container_name,host${local.by_cluster}} > ${var.cpu_usage_critical}"
# alert specific configuration
require_full_window = false
alert_message = "Container - CPU usage ({{ value }}) in {{ service }} exceeds {{ threshold }}"
recovery_message = "Container - CPU usage ({{ value }}) in {{ service }} has recovered"
custom_message = "${local.on_cluster}Host:{{host.name}} Container:{{container_name.name}}"
# monitor level vars
enabled = var.cpu_usage_enabled
alerting_enabled = var.cpu_usage_alerting_enabled
warning_threshold = var.cpu_usage_warning
critical_threshold = var.cpu_usage_critical
priority = min(var.cpu_usage_priority + var.priority_offset, 5)
docs = var.cpu_usage_docs
note = var.cpu_usage_note
# module level vars
env = var.env
service = var.service
notification_channel = var.notification_channel
additional_tags = var.additional_tags
locked = var.locked
name_prefix = var.name_prefix
name_suffix = var.name_suffix
}