MON-571 replace current_connections by total_requests metric

This commit is contained in:
gauthier.ampe@fr.clara.net 2020-03-19 17:40:37 +01:00 committed by Quentin Manfroi
parent 3611ecdad2
commit e8025afa09
4 changed files with 25 additions and 25 deletions

View File

@ -22,7 +22,7 @@ Creates DataDog monitors with the following checks:
- App Gateway backend HTTP 5xx errors rate is too high - App Gateway backend HTTP 5xx errors rate is too high
- App Gateway backend unhealthy host ratio is too high - App Gateway backend unhealthy host ratio is too high
- App Gateway failed requests - App Gateway failed requests
- App Gateway has no connection - App Gateway has no successful requests
- App Gateway HTTP 4xx errors rate is too high - App Gateway HTTP 4xx errors rate is too high
- App Gateway HTTP 5xx errors rate is too high - App Gateway HTTP 5xx errors rate is too high
- App Gateway is down - App Gateway is down
@ -81,11 +81,6 @@ Creates DataDog monitors with the following checks:
| appgateway\_unhealthy\_host\_ratio\_threshold\_warning | Warning regarding acceptable ratio of unhealthy host | `number` | `50` | no | | appgateway\_unhealthy\_host\_ratio\_threshold\_warning | Warning regarding acceptable ratio of unhealthy host | `number` | `50` | no |
| appgateway\_unhealthy\_host\_ratio\_time\_aggregator | Monitor aggregator for App Gateway unhealthy host ratio [available values: min, max or avg] | `string` | `"max"` | no | | appgateway\_unhealthy\_host\_ratio\_time\_aggregator | Monitor aggregator for App Gateway unhealthy host ratio [available values: min, max or avg] | `string` | `"max"` | no |
| appgateway\_unhealthy\_host\_ratio\_timeframe | Monitor timeframe for App Gateway unhealthy host ratio [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | `string` | `"last_5m"` | no | | appgateway\_unhealthy\_host\_ratio\_timeframe | Monitor timeframe for App Gateway unhealthy host ratio [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | `string` | `"last_5m"` | no |
| current\_connection\_enabled | Flag to enable App Gateway current connections monitor | `string` | `"true"` | no |
| current\_connection\_extra\_tags | Extra tags for App Gateway current connections monitor | `list(string)` | `[]` | no |
| current\_connection\_message | Custom message for App Gateway current connections monitor | `string` | `""` | no |
| current\_connection\_time\_aggregator | Monitor aggregator for App Gateway current connections [available values: min, max or avg] | `string` | `"max"` | no |
| current\_connection\_timeframe | Monitor timeframe for App Gateway current connections [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | `string` | `"last_5m"` | no |
| environment | Architecture environment | `string` | n/a | yes | | environment | Architecture environment | `string` | n/a | yes |
| evaluation\_delay | Delay in seconds for the metric evaluation | `number` | `900` | no | | evaluation\_delay | Delay in seconds for the metric evaluation | `number` | `900` | no |
| filter\_tags\_custom | Tags used for custom filtering when filter\_tags\_use\_defaults is false | `string` | `"*"` | no | | filter\_tags\_custom | Tags used for custom filtering when filter\_tags\_use\_defaults is false | `string` | `"*"` | no |
@ -100,6 +95,11 @@ Creates DataDog monitors with the following checks:
| status\_message | Custom message for App Gateway status | `string` | `""` | no | | status\_message | Custom message for App Gateway status | `string` | `""` | no |
| status\_time\_aggregator | Monitor aggregator for App Gateway status [available values: min, max or avg] | `string` | `"max"` | no | | status\_time\_aggregator | Monitor aggregator for App Gateway status [available values: min, max or avg] | `string` | `"max"` | no |
| status\_timeframe | Monitor timeframe for App Gateway status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | `string` | `"last_5m"` | no | | status\_timeframe | Monitor timeframe for App Gateway status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | `string` | `"last_5m"` | no |
| total\_requests\_enabled | Flag to enable App Gateway current connections monitor | `string` | `"true"` | no |
| total\_requests\_extra\_tags | Extra tags for App Gateway current connections monitor | `list(string)` | `[]` | no |
| total\_requests\_message | Custom message for App Gateway current connections monitor | `string` | `""` | no |
| total\_requests\_time\_aggregator | Monitor aggregator for App Gateway current connections [available values: min, max or avg] | `string` | `"max"` | no |
| total\_requests\_timeframe | Monitor timeframe for App Gateway current connections [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | `string` | `"last_15m"` | no |
## Outputs ## Outputs
@ -113,7 +113,7 @@ Creates DataDog monitors with the following checks:
| appgateway\_http\_4xx\_errors\_id | id for monitor appgateway\_http\_4xx\_errors | | appgateway\_http\_4xx\_errors\_id | id for monitor appgateway\_http\_4xx\_errors |
| appgateway\_http\_5xx\_errors\_id | id for monitor appgateway\_http\_5xx\_errors | | appgateway\_http\_5xx\_errors\_id | id for monitor appgateway\_http\_5xx\_errors |
| appgateway\_status\_id | id for monitor appgateway\_status | | appgateway\_status\_id | id for monitor appgateway\_status |
| current\_connection\_id | id for monitor current\_connection | | total\_requests\_id | id for monitor total\_requests |
## Related documentation ## Related documentation

View File

@ -81,35 +81,35 @@ variable "status_timeframe" {
default = "last_5m" default = "last_5m"
} }
# Monitoring App Gateway current_connections # Monitoring App Gateway total_requests
variable "current_connection_enabled" { variable "total_requests_enabled" {
description = "Flag to enable App Gateway current connections monitor" description = "Flag to enable App Gateway current connections monitor"
type = string type = string
default = "true" default = "true"
} }
variable "current_connection_extra_tags" { variable "total_requests_extra_tags" {
description = "Extra tags for App Gateway current connections monitor" description = "Extra tags for App Gateway current connections monitor"
type = list(string) type = list(string)
default = [] default = []
} }
variable "current_connection_message" { variable "total_requests_message" {
description = "Custom message for App Gateway current connections monitor" description = "Custom message for App Gateway current connections monitor"
type = string type = string
default = "" default = ""
} }
variable "current_connection_time_aggregator" { variable "total_requests_time_aggregator" {
description = "Monitor aggregator for App Gateway current connections [available values: min, max or avg]" description = "Monitor aggregator for App Gateway current connections [available values: min, max or avg]"
type = string type = string
default = "max" default = "max"
} }
variable "current_connection_timeframe" { variable "total_requests_timeframe" {
description = "Monitor timeframe for App Gateway current connections [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" description = "Monitor timeframe for App Gateway current connections [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
type = string type = string
default = "last_5m" default = "last_15m"
} }
# Monitoring App Gateway failed_requests # Monitoring App Gateway failed_requests

View File

@ -29,16 +29,16 @@ EOQ
} }
} }
# Monitoring App Gateway current_connections # Monitoring App Gateway total_requests
resource "datadog_monitor" "current_connection" { resource "datadog_monitor" "total_requests" {
count = var.current_connection_enabled == "true" ? 1 : 0 count = var.total_requests_enabled == "true" ? 1 : 0
name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway has no connection" name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Gateway has no successful requests"
message = coalesce(var.current_connection_message, var.message) message = coalesce(var.total_requests_message, var.message)
type = "query alert" type = "query alert"
query = <<EOQ query = <<EOQ
${var.current_connection_time_aggregator}(${var.current_connection_timeframe}): ${var.total_requests_time_aggregator}(${var.total_requests_timeframe}):
azure.network_applicationgateways.current_connections${module.filter-tags.query_alert} by {resource_group,region,name} < 1 azure.network_applicationgateways.total_requests${module.filter-tags.query_alert} by {resource_group,region,name} < 1
EOQ EOQ
evaluation_delay = var.evaluation_delay evaluation_delay = var.evaluation_delay
@ -51,7 +51,7 @@ EOQ
locked = false locked = false
require_full_window = false require_full_window = false
tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.current_connection_extra_tags) tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-gateway", "team:claranet", "created-by:terraform"], var.total_requests_extra_tags)
lifecycle { lifecycle {
ignore_changes = [silenced] ignore_changes = [silenced]

View File

@ -38,8 +38,8 @@ output "appgateway_status_id" {
value = datadog_monitor.appgateway_status.*.id value = datadog_monitor.appgateway_status.*.id
} }
output "current_connection_id" { output "total_requests_id" {
description = "id for monitor current_connection" description = "id for monitor total_requests"
value = datadog_monitor.current_connection.*.id value = datadog_monitor.total_requests.*.id
} }