MON-74 percent for requests

This commit is contained in:
Quentin Manfroi 2017-12-07 10:40:04 +01:00
parent 00e1ada46e
commit 223bcaf404
3 changed files with 29 additions and 39 deletions

View File

@ -19,9 +19,8 @@ Creates a DataDog monitors with the following checks :
* Response time * Response time
* Memory usage count * Memory usage count
* HTTP 404 errors * HTTP 404 requests
* HTTP 50x errors * HTTP 2xx requests
* HTTP 20x rate
Inputs Inputs
------ ------
@ -32,12 +31,10 @@ 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_status_rate_limit | | string | `30` | no | | http_2xx_requests_threshold_critical | Minimum critical acceptable percent of 2xx requests | string | `90` | no |
| http_2xx_status_rate_threshold_critical | Alerting threshold (percentage) | string | `0.9` | no | | http_2xx_requests_threshold_warning | Minimum warning acceptable percent of 2xx requests | string | `95` | no |
| http_2xx_status_rate_threshold_warning | Warning threshold (percentage) | string | `0.95` | no | | http_404_requests_threshold_critical | Maximum critical acceptable percent of 404 errors | string | `40` | no |
| http_404_errors_count_rate_limit | | string | `30` | no | | http_404_requests_threshold_warning | Maximum warning acceptable percent of 404 errors | string | `30` | no |
| http_404_errors_count_rate_threshold_critical | Alerting threshold (number of requests) | string | `30` | no |
| http_404_errors_count_rate_threshold_warning | Warning threshold (number of requests) | string | `10` | no |
| memory_usage_threshold_critical | Alerting threshold in Mib | string | `52430000` | no | | memory_usage_threshold_critical | Alerting threshold in Mib | string | `52430000` | no |
| memory_usage_threshold_warning | Warning threshold in MiB | string | `33550000` | no | | memory_usage_threshold_warning | Warning threshold in MiB | string | `33550000` | no |
| message | Message sent when a monitor is triggered | string | - | yes | | message | Message sent when a monitor is triggered | string | - | yes |

View File

@ -54,34 +54,26 @@ variable "memory_usage_threshold_warning" {
### HTTP 404 status pages ### ### HTTP 404 status pages ###
################################# #################################
variable "http_404_errors_count_rate_limit" { variable "http_404_requests_threshold_critical" {
default = 30 default = 40
description = "Maximum critical acceptable percent of 404 errors"
} }
variable "http_404_errors_count_rate_threshold_critical" { variable "http_404_requests_threshold_warning" {
default = 30 default = 30
description = "Alerting threshold (number of requests)" description = "Maximum critical acceptable percent of 404 errors"
}
variable "http_404_errors_count_rate_threshold_warning" {
default = 10
description = "Warning threshold (number of requests)"
} }
################################# #################################
### HTTP 202 status pages ### ### HTTP 202 status pages ###
################################# #################################
variable "http_2xx_status_rate_limit" { variable "http_2xx_requests_threshold_critical" {
default = 30 default = 90
description = "Minimum critical acceptable percent of 2xx requests"
} }
variable "http_2xx_status_rate_threshold_critical" { variable "http_2xx_requests_threshold_warning" {
default = 0.9 default = 95
description = "Alerting threshold (percentage)" description = "Minimum warning acceptable percent of 2xx requests"
}
variable "http_2xx_status_rate_threshold_warning" {
default = 0.95
description = "Warning threshold (percentage)"
} }

View File

@ -15,7 +15,7 @@ resource "datadog_monitor" "appservices_response_time" {
query = <<EOF query = <<EOF
avg(last_5m): ( avg(last_5m): (
avg:azure.app_services.average_response_time{${data.template_file.filter.rendered}} by {resource_group,region,name} avg:azure.app_services.average_response_time{${data.template_file.filter.rendered}} by {resource_group,region,name}
) >= ${var.response_time_threshold_critical} ) > ${var.response_time_threshold_critical}
EOF EOF
evaluation_delay = "${var.delay}" evaluation_delay = "${var.delay}"
@ -44,7 +44,7 @@ resource "datadog_monitor" "appservices_memory_usage_count" {
query = <<EOF query = <<EOF
avg(last_5m): ( avg(last_5m): (
avg:azure.app_services.memory_working_set{${data.template_file.filter.rendered}} by {resource_group,region,name} avg:azure.app_services.memory_working_set{${data.template_file.filter.rendered}} by {resource_group,region,name}
) >= ${var.memory_usage_threshold_critical} ) > ${var.memory_usage_threshold_critical}
EOF EOF
evaluation_delay = "${var.delay}" evaluation_delay = "${var.delay}"
@ -71,17 +71,18 @@ resource "datadog_monitor" "appservices_http_404_errors_count" {
message = "${var.message}" message = "${var.message}"
query = <<EOF query = <<EOF
max(last_5m): ( sum(last_5m): (
per_minute(avg:azure.app_services.http404{${data.template_file.filter.rendered}}.as_rate()) by {resource_group,region,name} avg:azure.app_services.http404{${data.template_file.filter.rendered}} by {resource_group,region,name}.as_count() /
) > ${var.http_404_errors_count_rate_threshold_critical} avg:azure.app_services.requests{${data.template_file.filter.rendered}} by {resource_group,region,name}.as_count()
) * 100 > ${var.http_404_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_errors_count_rate_threshold_warning}" warning = "${var.http_404_requests_threshold_warning}"
critical = "${var.http_404_errors_count_rate_threshold_critical}" critical = "${var.http_404_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
@ -102,16 +103,16 @@ resource "datadog_monitor" "appservices_http_2xx_status_rate" {
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.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()
) < ${var.http_2xx_status_rate_threshold_critical} ) * 100 < ${var.http_2xx_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_status_rate_threshold_warning}" warning = "${var.http_2xx_requests_threshold_warning}"
critical = "${var.http_2xx_status_rate_threshold_critical}" critical = "${var.http_2xx_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