Browse Source

feat: All prometheus_alert_group output and vars

tags/0.3.0
parent
commit
6cd9648f63
Signed by: christophe.vkerchove <christophe.vkerchove@fxinnovation.com> GPG Key ID: FC22F2DA87F093F1
6 changed files with 77 additions and 0 deletions
  1. +5
    -0
      CHANGELOG.md
  2. +3
    -0
      README.md
  3. +5
    -0
      examples/default/outputs.tf
  4. +45
    -0
      main.tf
  5. +5
    -0
      outputs.tf
  6. +14
    -0
      variables.tf

+ 5
- 0
CHANGELOG.md View File

@@ -1,4 +1,9 @@

0.3.0 / 2020-03-06
==================

* feat: All prometheus_alert_group output and vars

0.2.0 / 2020-02-26
==================



+ 3
- 0
README.md View File

@@ -31,6 +31,8 @@ Terraform module to deploy [cloudwatch_exporter](https://github.com/prometheus/c
| image\_version | Tag of the docker image to use. | `string` | `"latest"` | no |
| labels | Additionnal labels that will be merged on all resources. | `map` | `{}` | no |
| namespace | Namespace in which the module will be deployed. | `string` | `"default"` | no |
| prometheus\_alert\_groups\_rules\_annotations | Map of strings that will be merge on all prometheus alert groups rules annotations. | `map` | `{}` | no |
| prometheus\_alert\_groups\_rules\_labels | Map of strings that will be merge on all prometheus alert groups rules labels. | `map` | `{}` | no |
| replicas | Number of replicas to deploy. | `number` | `1` | no |
| secret\_annotations | Additionnal annotations that will be merged for the secret. | `map` | `{}` | no |
| secret\_key | Client secret that will be used by the cloudwatch-exporter. | `string` | n/a | yes |
@@ -56,6 +58,7 @@ Terraform module to deploy [cloudwatch_exporter](https://github.com/prometheus/c
| image\_pull\_policy | Image pull policy defined on the cloudwatch-exporter container. |
| image\_version | Tag of the docker image used for the cloudwatch-exporter container. |
| namespace | Name of the namespace in which the resources have been deployed. |
| prometheus\_alert\_groups | List of object representing prometheus alert groups you can import in prometheus to alert you in case of problems. |
| secret\_annotations | Map of annotations that are configured on the secret. |
| secret\_labels | Map of labels that are configured on the secret. |
| secret\_name | Name of the secret created by the module. |


+ 5
- 0
examples/default/outputs.tf View File

@@ -22,6 +22,11 @@ output "image_pull_policy" {
value = module.default.image_pull_policy
}

output "prometheus_alert_groups" {
description = "List of maps representing prometheus alert groups."
value = module.default.prometheus_alert_groups
}

#####
# Deployment
#####


+ 45
- 0
main.tf View File

@@ -13,6 +13,51 @@ locals {
configuration = yamlencode(var.configuration)
port = 9106
service_port = 80
prometheus_alert_groups = [
{
"name" = "cloudwatch-exporter"
"rules" = [
{
"alert" = "CloudwatchExporterScrapeErrors"
"expr" = "cloudwatch_exporter_scrape_error > 0"
"for" = "1m"
"labels" = merge(
{
"severity" = "critical"
"urgency" = "2"
},
var.prometheus_alert_groups_rules_labels
)
"annotations" = merge(
{
"summary" = "Cloudwatch Exporter - Scrape Error on {{ $labels.instance }}",
"description" = "Cloudwatch Exporter: \n {{ $labels.instance }} scrape error.\nLabels:\n{{ $labels }}"
},
var.prometheus_alert_groups_rules_annotations
)
},
{
"alert" = "CloudwatchExporterScrapeDurationError"
"expr" = "deriv(oracledb_exporter_last_scrape_duration_seconds[2m]) > 0.2 and oracledb_exporter_last_scrape_duration_seconds > 10"
"for" = "5m"
"labels" = merge(
{
"severity" = "warning"
"urgency" = "3"
},
var.prometheus_alert_groups_rules_labels
)
"annotations" = merge(
{
"summary" = "Cloudwatch Exporter - Scrape Duration Error on {{ $labels.instance }}",
"description" = "Cloudwatch Exporter:\n {{ $labels.instance }} scrape duration is too high.\nLabels:\n{{ $labels }}"
},
var.prometheus_alert_groups_rules_annotations
)
}
]
}
]
}

#####


+ 5
- 0
outputs.tf View File

@@ -22,6 +22,11 @@ output "image_pull_policy" {
value = var.enabled ? var.image_pull_policy : ""
}

output "prometheus_alert_groups" {
description = "List of object representing prometheus alert groups you can import in prometheus to alert you in case of problems."
value = var.enabled ? local.prometheus_alert_groups : []
}

#####
# Deployment
#####


+ 14
- 0
variables.tf View File

@@ -22,6 +22,20 @@ variable "namespace" {
default = "default"
}

#####
# Prometheus
#####

variable "prometheus_alert_groups_rules_labels" {
description = "Map of strings that will be merge on all prometheus alert groups rules labels."
default = {}
}

variable "prometheus_alert_groups_rules_annotations" {
description = "Map of strings that will be merge on all prometheus alert groups rules annotations."
default = {}
}

#####
# Application
#####


Loading…
Cancel
Save