Merged in MON-110-monitors-for-aws-kinesis-firehose (pull request #43)

MON-110 monitors for Kinesis Firehose

Approved-by: Jérôme Respaut <shr3ps@gmail.com>
Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr>
Approved-by: Adrien Broyere <adrien.broyere@fr.clara.net>
Approved-by: Alexandre Gaillet <alexandre.gaillet@fr.clara.net>
Approved-by: Guillaume Kérivel <guillaume.kerivel@fr.clara.net>
This commit is contained in:
Guillaume Kérivel 2018-02-23 09:29:55 +00:00 committed by Quentin Manfroi
commit 865a445d36
3 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,39 @@
AWS Kinesis Firehose DataDog monitors
==========================================
How to use this module
----------------------
```
module "datadog-monitors-aws-firehose" {
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/kinesis-firehose?ref={revision}"
message = "${module.datadog-message-alerting.alerting-message}"
environment = "${var.environment}"
}
```
Purpose
-------
Creates DataDog monitors with the following checks :
* No incoming record
Inputs
------
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| delay | Delay in seconds for the metric evaluation | string | `900` | no |
| environment | Environment | string | - | yes |
| 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 |
| incoming_records_timeframe | Monitor timeframe for incoming records metrics evaluation [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no |
| message | Message sent when an alert is triggered | string | - | yes |
Related documentation
---------------------
DataDog documentation: [https://docs.datadoghq.com/integrations/amazon_firehose/](https://docs.datadoghq.com/integrations/amazon_firehose/)
AWS Kinesis Firehose metrics documentation: [https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/akf-metricscollected.html](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/akf-metricscollected.html)

View File

@ -0,0 +1,31 @@
# Global Terraform
variable "environment" {
description = "Environment"
type = "string"
}
# Global DataDog
variable "delay" {
description = "Delay in seconds for the metric evaluation"
default = 900
}
variable "message" {
description = "Message sent when an alert is triggered"
}
variable "filter_tags_use_defaults" {
description = "Use default filter tags convention"
default = "true"
}
variable "filter_tags_custom" {
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
default = "*"
}
# Kinesis-Firehose
variable "incoming_records_timeframe" {
description = "Monitor timeframe for incoming records metrics evaluation [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
default = "last_15m"
}

View File

@ -0,0 +1,38 @@
data "template_file" "filter" {
template = "$${filter}"
vars {
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_aws_firehose:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
}
}
### Kinesis Firehose Incoming records ###
resource "datadog_monitor" "firehose_incoming_records" {
name = "[${var.environment}] Kinesis Firehose No incoming records"
message = "${var.message}"
type = "metric alert"
query = <<EOF
sum(${var.incoming_records_timeframe}): (
avg:aws.firehose.incoming_records{${data.template_file.filter.rendered}} by {region,deliverystreamname}
) <= 0
EOF
thresholds {
critical = 0
}
notify_no_data = true
evaluation_delay = "${var.delay}"
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
locked = false
require_full_window = false
new_host_delay = "${var.delay}"
no_data_timeframe = 20
tags = ["env:${var.environment}", "resource:kinesis-firehose", "team:aws", "provider:aws"]
}