From cc0e970dda93ef4d67823730bcc111be9b485b3d Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 22 Mar 2018 21:07:44 +0100 Subject: [PATCH] MON-112 add artificial request for false positive mitigation --- cloud/aws/alb/inputs.tf | 5 +++++ cloud/aws/alb/monitors-alb.tf | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cloud/aws/alb/inputs.tf b/cloud/aws/alb/inputs.tf index 32a7278..e6d71dd 100644 --- a/cloud/aws/alb/inputs.tf +++ b/cloud/aws/alb/inputs.tf @@ -147,3 +147,8 @@ variable "httpcode_target_5xx_threshold_warning" { default = 60 description = "target 5xx warning threshold in percentage" } + +variable "artificial_requests_count" { + default = 5 + description = "Number of false requests used to mitigate false positive in case of low trafic" +} diff --git a/cloud/aws/alb/monitors-alb.tf b/cloud/aws/alb/monitors-alb.tf index 6e7d823..e03c8d2 100644 --- a/cloud/aws/alb/monitors-alb.tf +++ b/cloud/aws/alb/monitors-alb.tf @@ -76,7 +76,7 @@ resource "datadog_monitor" "ALB_httpcode_elb_5xx" { sum(last_5m): ( default( avg:aws.applicationelb.httpcode_elb_5xx{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count() / - avg:aws.applicationelb.request_count{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count(), + (avg:aws.applicationelb.request_count{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count() + ${var.artificial_requests_count}), 0) * 100 ) > ${var.httpcode_elb_5xx_threshold_critical} EOF @@ -109,7 +109,7 @@ resource "datadog_monitor" "ALB_httpcode_elb_4xx" { sum(last_5m): ( default( avg:aws.applicationelb.httpcode_elb_4xx{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count() / - avg:aws.applicationelb.request_count{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count(), + (avg:aws.applicationelb.request_count{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count() + ${var.artificial_requests_count}), 0) * 100 ) > ${var.httpcode_elb_4xx_threshold_critical} EOF @@ -142,7 +142,7 @@ resource "datadog_monitor" "ALB_httpcode_target_5xx" { sum(last_5m): ( default( avg:aws.applicationelb.httpcode_target_5xx{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count() / - avg:aws.applicationelb.request_count{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count(), + (avg:aws.applicationelb.request_count{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count() + ${var.artificial_requests_count}), 0) * 100 ) > ${var.httpcode_target_5xx_threshold_critical} EOF @@ -175,7 +175,7 @@ resource "datadog_monitor" "ALB_httpcode_target_4xx" { sum(last_5m): ( default( avg:aws.applicationelb.httpcode_target_4xx{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count() / - avg:aws.applicationelb.request_count{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count(), + (avg:aws.applicationelb.request_count{${data.template_file.filter.rendered}} by {region,loadbalancer}.as_count() + ${var.artificial_requests_count}), 0) * 100 ) > ${var.httpcode_target_4xx_threshold_critical} EOF