Skip to content

Commit 964974e

Browse files
committed
adding connections monitoring
1 parent 59ee81a commit 964974e

File tree

3 files changed

+81
-1
lines changed

3 files changed

+81
-1
lines changed

connections-variables.tf

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
variable "connections_enabled" {
2+
type = bool
3+
default = true
4+
}
5+
6+
variable "connections_warning" {
7+
type = number
8+
default = 400
9+
}
10+
11+
variable "connections_critical" {
12+
type = number
13+
default = 500
14+
}
15+
16+
variable "connections_evaluation_period" {
17+
type = string
18+
default = "last_30m"
19+
}
20+
21+
variable "connections_note" {
22+
type = string
23+
default = ""
24+
}
25+
26+
variable "connections_docs" {
27+
type = string
28+
default = ""
29+
}
30+
31+
variable "connections_filter_override" {
32+
type = string
33+
default = ""
34+
}
35+
36+
variable "connections_alerting_enabled" {
37+
type = bool
38+
default = true
39+
}
40+
41+
variable "connections_priority" {
42+
description = "Number from 1 (high) to 5 (low)."
43+
44+
type = number
45+
default = 3
46+
}

connections.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
locals {
2+
connections_filter = coalesce(
3+
var.connections_filter_override,
4+
var.filter_str
5+
)
6+
}
7+
8+
module "connections" {
9+
source = "[email protected]:kabisa/terraform-datadog-generic-monitor.git?ref=0.6.2"
10+
11+
name = "SQL Server - Blocked processes"
12+
query = "avg(${var.connections_evaluation_period}):max:sqlserver.stats.connections{${local.connections_filter}} by {host} >= ${var.connections_critical}"
13+
14+
alert_message = "Unusual high number of SQL Server connections on {{host.name}} has increased above {{threshold}} current connection count: ({{value}}"
15+
recovery_message = "Number of SQL Server connections of {{host.name}} has recovered ({{value}}"
16+
17+
# monitor level vars
18+
enabled = var.connections_enabled
19+
alerting_enabled = var.connections_alerting_enabled
20+
warning_threshold = var.connections_warning
21+
critical_threshold = var.connections_critical
22+
priority = var.connections_priority
23+
docs = var.connections_docs
24+
note = var.connections_note
25+
26+
# module level vars
27+
env = var.alert_env
28+
service = var.service
29+
notification_channel = var.notification_channel
30+
additional_tags = var.additional_tags
31+
locked = var.locked
32+
name_prefix = var.name_prefix
33+
name_suffix = var.name_suffix
34+
}

procs-blocked.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ locals {
88
module "procs_blocked" {
99
source = "[email protected]:kabisa/terraform-datadog-generic-monitor.git?ref=0.6.2"
1010

11-
name = "SQL Server - Lock waits"
11+
name = "SQL Server - Blocked processes"
1212
query = "avg(${var.procs_blocked_evaluation_period}):max:sqlserver.stats.procs_blocked{${local.procs_blocked_filter}} by {host} >= ${var.procs_blocked_critical}"
1313

1414
alert_message = "Procs blocked on {{host.name}} has increased above {{threshold}} per second ({{value}} per second)"

0 commit comments

Comments
 (0)