MON-74 Change 404 errors to 4xx

This commit is contained in:
Quentin Manfroi 2017-12-15 13:29:25 +01:00
parent 3a56b974c1
commit e3e3469cfb
3 changed files with 15 additions and 15 deletions

View File

@ -20,7 +20,7 @@ Creates a DataDog monitors with the following checks :
* Response time * Response time
* Memory usage count * Memory usage count
* HTTP 5xx requests * HTTP 5xx requests
* HTTP 404 requests * HTTP 4xx requests
* HTTP 2xx requests * HTTP 2xx requests
Inputs Inputs
@ -34,8 +34,8 @@ Inputs
| 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_2xx_requests_threshold_critical | Minimum critical acceptable percent of 2xx requests | string | `90` | no |
| http_2xx_requests_threshold_warning | Minimum warning acceptable percent of 2xx requests | string | `95` | no | | http_2xx_requests_threshold_warning | Minimum warning acceptable percent of 2xx requests | string | `95` | no |
| http_404_requests_threshold_critical | Maximum critical acceptable percent of 404 errors | string | `40` | no | | http_4xx_requests_threshold_critical | Maximum critical acceptable percent of 4xx errors | string | `40` | no |
| http_404_requests_threshold_warning | Maximum warning acceptable percent of 404 errors | string | `30` | no | | http_4xx_requests_threshold_warning | Maximum warning acceptable percent of 4xx errors | string | `30` | no |
| http_5xx_requests_threshold_critical | Maximum critical acceptable percent of 5xx errors | string | `40` | no | | http_5xx_requests_threshold_critical | Maximum critical acceptable percent of 5xx errors | string | `40` | no |
| http_5xx_requests_threshold_warning | Maximum warning acceptable percent of 5xx errors | string | `30` | no | | http_5xx_requests_threshold_warning | Maximum warning acceptable percent of 5xx errors | string | `30` | no |
| memory_usage_threshold_critical | Alerting threshold in Mib | string | `52430000` | no | | memory_usage_threshold_critical | Alerting threshold in Mib | string | `52430000` | no |

View File

@ -65,17 +65,17 @@ variable "http_5xx_requests_threshold_warning" {
} }
################################# #################################
### HTTP 404 status pages ### ### HTTP 4xx status pages ###
################################# #################################
variable "http_404_requests_threshold_critical" { variable "http_4xx_requests_threshold_critical" {
default = 30 default = 30
description = "Maximum critical acceptable percent of 404 errors" description = "Maximum critical acceptable percent of 4xx errors"
} }
variable "http_404_requests_threshold_warning" { variable "http_4xx_requests_threshold_warning" {
default = 15 default = 15
description = "Maximum warning acceptable percent of 404 errors" description = "Maximum warning acceptable percent of 4xx errors"
} }
################################# #################################

View File

@ -94,25 +94,25 @@ resource "datadog_monitor" "appservices_http_5xx_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 404 errors percent # Monitoring App Services 4xx errors percent
resource "datadog_monitor" "appservices_http_404_errors_count" { resource "datadog_monitor" "appservices_http_4xx_errors_count" {
name = "[${var.environment}] App Services HTTP 404 errors is {{value}}% above the limit on {{name}}" name = "[${var.environment}] App Services HTTP 4xx errors is {{value}}% above 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.http404{${data.template_file.filter.rendered}} by {resource_group,region,name}.as_count() / avg:azure.app_services.http4xx{${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_404_requests_threshold_critical} ) * 100 > ${var.http_4xx_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_404_requests_threshold_warning}" warning = "${var.http_4xx_requests_threshold_warning}"
critical = "${var.http_404_requests_threshold_critical}" critical = "${var.http_4xx_requests_threshold_critical}"
} }
notify_no_data = false # Will NOT notify when no data is received notify_no_data = false # Will NOT notify when no data is received