MON-92 Added MongoDB Monitor
This commit is contained in:
parent
b53e5fa34e
commit
c4841850d8
48
databases/mongodb/README.md
Normal file
48
databases/mongodb/README.md
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
###MongoDB Monitors
|
||||||
|
|
||||||
|
Link to integration documentation :
|
||||||
|
|
||||||
|
``https://docs.datadoghq.com/integrations/mongo/``
|
||||||
|
|
||||||
|
**Prepare your ReplicaSet** :
|
||||||
|
|
||||||
|
Add a user to your ReplicaSet (on the primary instance)
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
use admin
|
||||||
|
db.auth("admin", "admin-password") ## This is optional is you don't have any admin password
|
||||||
|
db.createUser({"user":"datadog", "pwd": "{{PASSWORD}}", "roles" : [ {role: 'read', db: 'admin' }, {role: 'clusterMonitor', db: 'admin'}, {role: 'read', db: 'local' }]})
|
||||||
|
```
|
||||||
|
|
||||||
|
**Configure your Datadog agent**
|
||||||
|
|
||||||
|
Add this file conf.d/mongo.yaml
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
init_config:
|
||||||
|
|
||||||
|
instances:
|
||||||
|
- server: mongodb://datadog:password@[MONGO_URI]
|
||||||
|
tags:
|
||||||
|
- mytag1
|
||||||
|
- mytag2
|
||||||
|
- server: mongodb://datadog:password@[MONGO_URI]
|
||||||
|
tags:
|
||||||
|
- mytag1
|
||||||
|
- mytag2
|
||||||
|
```
|
||||||
|
|
||||||
|
**Monitor ReplicaSet Health**
|
||||||
|
|
||||||
|
Name: [environment] Replica Set heath for {{ replset_name }}
|
||||||
|
|
||||||
|
This monitor will check the health of your ReplicaSet
|
||||||
|
|
||||||
|
Metrics are :
|
||||||
|
|
||||||
|
1: The replicaSet is OK
|
||||||
|
0: The replicaSet is KO
|
||||||
|
|
||||||
|
This monitor will trigger an alert for each ReplicaSet.
|
||||||
1
databases/mongodb/inputs.tf
Symbolic link
1
databases/mongodb/inputs.tf
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../inputs.tf
|
||||||
34
databases/mongodb/monitors-mongo.tf
Normal file
34
databases/mongodb/monitors-mongo.tf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
module "message" {
|
||||||
|
source = "../../common/alerting-message"
|
||||||
|
oncall_24x7 = "${var.hno_escalation_group}"
|
||||||
|
oncall_office_hours = "${var.ho_escalation_group}"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "datadog_monitor" "Mongodb_ReplicaSet_State" {
|
||||||
|
name = "[${var.env}] Replica Set heath for {{ replset_name }}"
|
||||||
|
message = "${module.message.alerting-message}"
|
||||||
|
|
||||||
|
query = <<EOF
|
||||||
|
avg(last_5m): (
|
||||||
|
avg:mongodb.replset.health{dd_monitoring:enabled,dd_monitoring_mongodb,env:${var.env}} by {replset_name}
|
||||||
|
) == ${var.mongo_config["critical"]}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
type = "query alert"
|
||||||
|
|
||||||
|
thresholds {
|
||||||
|
ok = "${var.mongo_config["ok"]}"
|
||||||
|
critical = "${var.mongo_config["critical"]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_no_data = true
|
||||||
|
renotify_interval = 15
|
||||||
|
evaluation_delay = "${var.mongo_config["delay"]}"
|
||||||
|
notify_audit = false
|
||||||
|
timeout_h = 0
|
||||||
|
include_tags = true
|
||||||
|
locked = false
|
||||||
|
require_full_window = true
|
||||||
|
|
||||||
|
tags = ["env:${var.env}", "type:mongodb"]
|
||||||
|
}
|
||||||
19
inputs.tf
19
inputs.tf
@ -60,6 +60,8 @@ variable "rds_cpu_threshold" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "rds_mem_threshold" {
|
variable "rds_mem_threshold" {
|
||||||
|
type = "map"
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
warning = 20
|
warning = 20
|
||||||
critical = 10
|
critical = 10
|
||||||
@ -81,6 +83,8 @@ variable "elb_config" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "elb_5xx_threshold" {
|
variable "elb_5xx_threshold" {
|
||||||
|
type = "map"
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
warning = 5
|
warning = 5
|
||||||
critical = 10
|
critical = 10
|
||||||
@ -88,6 +92,8 @@ variable "elb_5xx_threshold" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable "elb_4xx_threshold" {
|
variable "elb_4xx_threshold" {
|
||||||
|
type = "map"
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
warning = 5
|
warning = 5
|
||||||
critical = 10
|
critical = 10
|
||||||
@ -96,7 +102,6 @@ variable "elb_4xx_threshold" {
|
|||||||
|
|
||||||
variable "elb_backend_latency" {
|
variable "elb_backend_latency" {
|
||||||
description = "Average time elapsed after the request leaves the load balancer until a response is received. In seconds"
|
description = "Average time elapsed after the request leaves the load balancer until a response is received. In seconds"
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
warning = 1
|
warning = 1
|
||||||
critical = 5
|
critical = 5
|
||||||
@ -133,3 +138,15 @@ variable "php_fpm_busy_threshold" {
|
|||||||
critical = 0.9
|
critical = 0.9
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##MongoDB
|
||||||
|
variable "mongo_config" {
|
||||||
|
description = "Critical means the ReplicaSet is DOWN and OK means the ReplicaSet is UP"
|
||||||
|
type = "map"
|
||||||
|
|
||||||
|
default = {
|
||||||
|
delay = 0
|
||||||
|
critical = 0
|
||||||
|
ok = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user