MON-185 - ServiceBus monitors added
This commit is contained in:
parent
6e6d23c604
commit
350faf0fcf
39
cloud/azure/servicebus/README.md
Normal file
39
cloud/azure/servicebus/README.md
Normal file
@ -0,0 +1,39 @@
|
||||
Service Bus Datadog monitor
|
||||
===========================
|
||||
|
||||
How to use this module
|
||||
----------------------
|
||||
|
||||
```
|
||||
module "datadog-monitors-azure-servicebus" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/servicebus?ref={revision}"
|
||||
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
environment = "${var.environment}"
|
||||
subscription_id = "${var.subscription_id}"
|
||||
}
|
||||
```
|
||||
|
||||
Purpose
|
||||
-------
|
||||
Creates a Datadog monitor with the following checks :
|
||||
|
||||
* Service status check
|
||||
|
||||
Inputs
|
||||
------
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| delay | Delay in seconds for the metric evaluation | string | `900` | no |
|
||||
| environment | Architecture Environment | string | - | yes |
|
||||
| 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 |
|
||||
| message | Message sent when an alert is triggered | string | - | yes |
|
||||
| status_message | Custom message for Service Bus status monitor | string | `` | no |
|
||||
| status_silenced | Groups to mute for Service Bus status monitor | map | `<map>` | no |
|
||||
|
||||
Related documentation
|
||||
---------------------
|
||||
|
||||
Azure metrics documentation : [https://docs.microsoft.com/fr-fr/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftservicebusnamespaces](https://docs.microsoft.com/fr-fr/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftservicebusnamespaces)
|
||||
38
cloud/azure/servicebus/inputs.tf
Normal file
38
cloud/azure/servicebus/inputs.tf
Normal file
@ -0,0 +1,38 @@
|
||||
# Global Terraform
|
||||
variable "environment" {
|
||||
description = "Architecture Environment"
|
||||
type = "string"
|
||||
}
|
||||
|
||||
# Global DataDog
|
||||
variable "delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 900
|
||||
}
|
||||
|
||||
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 = "*"
|
||||
}
|
||||
|
||||
# Azure Service Bus specific variables
|
||||
variable "status_silenced" {
|
||||
description = "Groups to mute for Service Bus status monitor"
|
||||
type = "map"
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "status_message" {
|
||||
description = "Custom message for Service Bus status monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
32
cloud/azure/servicebus/monitors-service-bus.tf
Normal file
32
cloud/azure/servicebus/monitors-service-bus.tf
Normal file
@ -0,0 +1,32 @@
|
||||
data "template_file" "filter" {
|
||||
template = "$${filter}"
|
||||
|
||||
vars {
|
||||
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_azure_servicebus:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "servicebus_status" {
|
||||
name = "[${var.environment}] Service Bus is down"
|
||||
message = "${coalesce(var.status_message, var.message)}"
|
||||
|
||||
query = <<EOF
|
||||
avg(last_5m): avg:azure.servicebus_namespaces.status{${data.template_file.filter.rendered}} by {resource_group,region,name} != 1
|
||||
EOF
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
silenced = "${var.status_silenced}"
|
||||
|
||||
notify_no_data = true
|
||||
evaluation_delay = "${var.delay}"
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
include_tags = true
|
||||
locked = false
|
||||
require_full_window = false
|
||||
new_host_delay = "${var.delay}"
|
||||
|
||||
tags = ["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user