Merged in MON-99-azure-app-service-monitor-count-2 (pull request #36)

MON-99 : Azure App Service monitor : count 2xx & 3xx http status codes as successful

Approved-by: Laurent Piroelle <laurent.piroelle@fr.clara.net>
Approved-by: Jérôme Respaut <shr3ps@gmail.com>
Approved-by: Alexandre Gaillet <alexandre.gaillet@fr.clara.net>
Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr>
This commit is contained in:
Laurent Piroelle 2018-01-10 15:26:48 +00:00 committed by Quentin Manfroi
commit 6b9ae9798f
6 changed files with 30 additions and 29 deletions

View File

@ -35,8 +35,8 @@ Inputs
| apimanagement_other_requests_threshold_critical | Maximum acceptable percent of other requests | string | `5` | no | | apimanagement_other_requests_threshold_critical | Maximum acceptable percent of other requests | string | `5` | no |
| apimanagement_successful_requests_threshold_critical | Minimum acceptable percent of successful requests | string | `90` | no | | apimanagement_successful_requests_threshold_critical | Minimum acceptable percent of successful requests | string | `90` | no |
| apimanagement_unauthorized_requests_threshold_critical | Maximum acceptable percent of unauthorized requests | string | `5` | no | | apimanagement_unauthorized_requests_threshold_critical | Maximum acceptable percent of unauthorized requests | string | `5` | no |
| appservices_http_2xx_requests_threshold_critical | Minimum critical acceptable percent of 2xx requests | string | `90` | no | | appservices_http_successful_requests_threshold_critical | Minimum critical acceptable percent of 2xx & 3xx requests | string | `90` | no |
| appservices_http_2xx_requests_threshold_warning | Minimum warning acceptable percent of 2xx requests | string | `95` | no | | appservices_http_successful_requests_threshold_warning | Minimum warning acceptable percent of 2xx & 3xx requests | string | `95` | no |
| appservices_http_4xx_requests_threshold_critical | Maximum critical acceptable percent of 4xx errors | string | `30` | no | | appservices_http_4xx_requests_threshold_critical | Maximum critical acceptable percent of 4xx errors | string | `30` | no |
| appservices_http_4xx_requests_threshold_warning | Maximum warning acceptable percent of 4xx errors | string | `15` | no | | appservices_http_4xx_requests_threshold_warning | Maximum warning acceptable percent of 4xx errors | string | `15` | no |
| appservices_http_5xx_requests_threshold_critical | Maximum critical acceptable percent of 5xx errors | string | `20` | no | | appservices_http_5xx_requests_threshold_critical | Maximum critical acceptable percent of 5xx errors | string | `20` | no |

View File

@ -32,8 +32,8 @@ Inputs
| environment | Architecture environment | string | - | yes | | environment | Architecture environment | string | - | yes |
| 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 |
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | | filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
| http_2xx_requests_threshold_critical | Minimum critical acceptable percent of 2xx requests | string | `90` | no | | http_successful_requests_threshold_critical | Minimum critical acceptable percent of 2xx & 3xx requests | string | `90` | no |
| http_2xx_requests_threshold_warning | Minimum warning acceptable percent of 2xx requests | string | `95` | no | | http_successful_requests_threshold_warning | Minimum warning acceptable percent of 2xx & 3xx requests | string | `95` | no |
| http_4xx_requests_threshold_critical | Maximum critical acceptable percent of 4xx errors | string | `30` | no | | http_4xx_requests_threshold_critical | Maximum critical acceptable percent of 4xx errors | string | `30` | no |
| http_4xx_requests_threshold_warning | Maximum warning acceptable percent of 4xx errors | string | `15` | no | | http_4xx_requests_threshold_warning | Maximum warning acceptable percent of 4xx errors | string | `15` | no |
| http_5xx_requests_threshold_critical | Maximum critical acceptable percent of 5xx errors | string | `20` | no | | http_5xx_requests_threshold_critical | Maximum critical acceptable percent of 5xx errors | string | `20` | no |

View File

@ -82,12 +82,12 @@ variable "http_4xx_requests_threshold_warning" {
### HTTP 2xx status pages ### ### HTTP 2xx status pages ###
################################# #################################
variable "http_2xx_requests_threshold_critical" { variable "http_successful_requests_threshold_critical" {
default = 90 default = 90
description = "Minimum critical acceptable percent of 2xx requests" description = "Minimum critical acceptable percent of 2xx & 3xx requests"
} }
variable "http_2xx_requests_threshold_warning" { variable "http_successful_requests_threshold_warning" {
default = 95 default = 95
description = "Minimum warning acceptable percent of 2xx requests" description = "Minimum warning acceptable percent of 2xx & 3xx requests"
} }

View File

@ -124,25 +124,26 @@ resource "datadog_monitor" "appservices_http_4xx_errors_count" {
tags = ["env:${var.environment}", "resource:appservices", "team:azure", "provider:azure"] tags = ["env:${var.environment}", "resource:appservices", "team:azure", "provider:azure"]
} }
# Monitoring App Services HTTP 2xx status pages percent # Monitoring App Services HTTP 2xx & 3xx status pages percent
resource "datadog_monitor" "appservices_http_2xx_status_rate" { resource "datadog_monitor" "appservices_http_success_status_rate" {
name = "[${var.environment}] App Services HTTP 2xx responses is {{value}}% below the limit on {{name}}" name = "[${var.environment}] App Services HTTP successful responses is {{value}}% below the limit on {{name}}"
type = "metric alert" type = "metric alert"
message = "${var.message}" message = "${var.message}"
query = <<EOF query = <<EOF
sum(last_5m): ( sum(last_5m): (
avg:azure.app_services.http2xx{${data.template_file.filter.rendered}} by {resource_group,region,name}.as_count() / (avg:azure.app_services.http2xx{${data.template_file.filter.rendered}} by {resource_group,region,name}.as_count() +
avg:azure.app_services.http3xx{${data.template_file.filter.rendered}} by {resource_group,region,name}.as_count()) /
avg:azure.app_services.requests{${data.template_file.filter.rendered}} by {resource_group,region,name}.as_count() avg:azure.app_services.requests{${data.template_file.filter.rendered}} by {resource_group,region,name}.as_count()
) * 100 < ${var.http_2xx_requests_threshold_critical} ) * 100 < ${var.http_successful_requests_threshold_critical}
EOF EOF
evaluation_delay = "${var.delay}" evaluation_delay = "${var.delay}"
new_host_delay = "${var.delay}" new_host_delay = "${var.delay}"
thresholds { thresholds {
warning = "${var.http_2xx_requests_threshold_warning}" warning = "${var.http_successful_requests_threshold_warning}"
critical = "${var.http_2xx_requests_threshold_critical}" critical = "${var.http_successful_requests_threshold_critical}"
} }
notify_no_data = false # Will notify when no data is received notify_no_data = false # Will notify when no data is received

View File

@ -90,14 +90,14 @@ variable "appservices_http_5xx_requests_threshold_warning" {
description = "Maximum warning acceptable percent of 5xx errors" description = "Maximum warning acceptable percent of 5xx errors"
} }
variable "appservices_http_2xx_requests_threshold_critical" { variable "appservices_http_successful_requests_threshold_critical" {
default = 90 default = 90
description = "Minimum critical acceptable percent of 2xx requests" description = "Minimum critical acceptable percent of 2xx & 3xx requests"
} }
variable "appservices_http_2xx_requests_threshold_warning" { variable "appservices_http_successful_requests_threshold_warning" {
default = 95 default = 95
description = "Minimum warning acceptable percent of 2xx requests" description = "Minimum warning acceptable percent of 2xx & 3xx requests"
} }
# Azure Event Hub specific variables # Azure Event Hub specific variables

View File

@ -24,16 +24,16 @@ module "appservices" {
filter_tags_use_defaults = "${var.filter_tags_use_defaults}" filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
filter_tags_custom = "${var.filter_tags_custom}" filter_tags_custom = "${var.filter_tags_custom}"
http_2xx_requests_threshold_critical = "${var.appservices_http_2xx_requests_threshold_critical}" http_successful_requests_threshold_critical = "${var.appservices_http_successful_requests_threshold_critical}"
http_2xx_requests_threshold_warning = "${var.appservices_http_2xx_requests_threshold_warning}" http_successful_requests_threshold_warning = "${var.appservices_http_successful_requests_threshold_warning}"
http_5xx_requests_threshold_critical = "${var.appservices_http_5xx_requests_threshold_critical}" http_5xx_requests_threshold_critical = "${var.appservices_http_5xx_requests_threshold_critical}"
http_5xx_requests_threshold_warning = "${var.appservices_http_5xx_requests_threshold_warning}" http_5xx_requests_threshold_warning = "${var.appservices_http_5xx_requests_threshold_warning}"
http_4xx_requests_threshold_critical = "${var.appservices_http_4xx_requests_threshold_critical}" http_4xx_requests_threshold_critical = "${var.appservices_http_4xx_requests_threshold_critical}"
http_4xx_requests_threshold_warning = "${var.appservices_http_4xx_requests_threshold_warning}" http_4xx_requests_threshold_warning = "${var.appservices_http_4xx_requests_threshold_warning}"
memory_usage_threshold_critical = "${var.appservices_memory_usage_threshold_critical}" memory_usage_threshold_critical = "${var.appservices_memory_usage_threshold_critical}"
memory_usage_threshold_warning = "${var.appservices_memory_usage_threshold_warning}" memory_usage_threshold_warning = "${var.appservices_memory_usage_threshold_warning}"
response_time_threshold_critical = "${var.appservices_response_time_threshold_critical}" response_time_threshold_critical = "${var.appservices_response_time_threshold_critical}"
response_time_threshold_warning = "${var.appservices_response_time_threshold_warning}" response_time_threshold_warning = "${var.appservices_response_time_threshold_warning}"
} }
module "eventhub" { module "eventhub" {