MON-39 Monitor Data Sent removed. No data is not within the scope of this module.

This commit is contained in:
Rafael Romero Carmona 2019-08-29 12:49:45 +01:00
parent 39ae4bba9b
commit 31d40303ca
4 changed files with 39 additions and 90 deletions

View File

@ -1,10 +1,10 @@
# NEW-RELIC DataDog monitors
# SAAS NEW-RELIC DataDog monitors
## How to use this module
```
module "datadog-monitors-new-relic" {
source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//new-relic?ref={revision}"
module "datadog-monitors-saas-new-relic" {
source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//saas/new-relic?ref={revision}"
environment = var.environment
message = module.datadog-message-alerting.alerting-message
@ -17,9 +17,41 @@ module "datadog-monitors-new-relic" {
Creates DataDog monitors with the following checks:
- New Relic Apdex score ratio
- New Relic application has no-data
- New Relic Error rate
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| app\_apdex\_score\_enabled | Flag to enable APP Apdex Score monitor | string | `"true"` | no |
| app\_apdex\_score\_extra\_tags | Extra tags for New Relic APP Apdex Score monitor | list(string) | `[]` | no |
| app\_apdex\_score\_message | Custom message for the APP Apdex Score monitor | string | `""` | no |
| app\_apdex\_score\_threshold\_critical | APP Apdex Score critical threshold | string | `"0.25"` | no |
| app\_apdex\_score\_threshold\_warning | APP Apdex Score warning threshold | string | `"0.5"` | no |
| app\_apdex\_score\_time\_aggregator | Time aggregator for the APP Apdex Score monitor | string | `"avg"` | no |
| app\_apdex\_score\_timeframe | Timeframe for the APP Apdex Score monitor | string | `"last_15m"` | no |
| app\_error\_rate\_enabled | Flag to enable APP Error Rate monitor | string | `"true"` | no |
| app\_error\_rate\_extra\_tags | Extra tags for New Relic APP Error Rate monitor | list(string) | `[]` | no |
| app\_error\_rate\_message | Custom message for the APP Error Rate monitor | string | `""` | no |
| app\_error\_rate\_threshold\_critical | APP Error Rate critical threshold | string | `"5"` | no |
| app\_error\_rate\_threshold\_warning | APP Error Rate warning threshold | string | `"1"` | no |
| app\_error\_rate\_time\_aggregator | Time aggregator for the APP Error Rate monitor | string | `"min"` | no |
| app\_error\_rate\_timeframe | Timeframe for the APP Error Rate monitor | string | `"last_5m"` | no |
| environment | Architecture Environment | string | n/a | yes |
| evaluation\_delay | Delay in seconds for the metric evaluation | string | `"900"` | no |
| filter\_tags\_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `"*"` | no |
| filter\_tags\_custom\_excluded | Tags excluded for custom filtering when filter_tags_use_defaults is false | string | `""` | no |
| filter\_tags\_use\_defaults | Use default filter tags convention | string | `"true"` | no |
| message | Message sent when an alert is triggered | string | n/a | yes |
| new\_host\_delay | Delay in seconds before monitor new resource | string | `"300"` | no |
| prefix\_slug | Prefix string to prepend between brackets on every monitors names | string | `""` | no |
## Outputs
| Name | Description |
|------|-------------|
| app\_apdex\_score\_id | id for monitor app_apdex_score |
| app\_error\_rate\_id | id for monitor app_error_rate |
## Related documentation

View File

@ -128,43 +128,3 @@ variable "app_apdex_score_extra_tags" {
type = list(string)
default = []
}
#
# Data sent
#
variable "data_sent_enabled" {
description = "Flag to enable New Relic Data Sent monitor"
type = string
default = "true"
}
variable "data_sent_message" {
description = "Custom message for the New Relic Data Sent monitor"
type = string
default = ""
}
variable "data_sent_time_aggregator" {
description = "Time aggregator for the New Relic Data Sent monitor"
type = string
default = "avg"
}
variable "data_sent_timeframe" {
description = "Timeframe for the New Relic Data Sent monitor"
type = string
default = "last_15m"
}
variable "data_sent_no_data_timeframe" {
description = "No data timeframe for the New Relic Data Sent monitor"
type = string
default = 30
}
variable "data_sent_extra_tags" {
description = "Extra tags for New Relic Data Sent monitor"
type = list(string)
default = []
}

View File

@ -65,41 +65,3 @@ EOQ
ignore_changes = ["silenced"]
}
}
#
# No Data
#
resource "datadog_monitor" "data_sent" {
count = var.data_sent_enabled == "true" ? 1 : 0
name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] New Relic application has no-data"
message = coalesce(var.data_sent_message, var.message)
type = "query alert"
query = <<EOQ
${var.data_sent_time_aggregator}(${var.data_sent_timeframe}):
avg:new_relic.apdex.score${module.filter-tags.query_alert} by {application}
< 0
EOQ
thresholds = {
# No alert for this monitor, just send notification in case of no-data
critical = 0
}
evaluation_delay = var.evaluation_delay
new_host_delay = var.new_host_delay
no_data_timeframe = var.data_sent_no_data_timeframe
notify_no_data = true
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
locked = false
require_full_window = false
tags = concat(["env:${var.environment}", "type:saas", "provider:new-relic", "resource:new-relic", "team:claranet", "created-by:terraform"], var.data_sent_extra_tags)
lifecycle {
ignore_changes = ["silenced"]
}
}

View File

@ -1,15 +1,10 @@
output "app_error_rate_id" {
description = "id for monitor app_error_rate"
value = datadog_monitor.app_error_rate.*.id
}
output "app_apdex_score_id" {
description = "id for monitor app_apdex_score"
value = datadog_monitor.app_apdex_score.*.id
}
output "data_sent_id" {
description = "id for monitor data_sent"
value = datadog_monitor.data_sent.*.id
output "app_error_rate_id" {
description = "id for monitor app_error_rate"
value = datadog_monitor.app_error_rate.*.id
}