MON-105 add output and autoupdate

This commit is contained in:
Quentin Manfroi 2018-09-18 15:21:29 +02:00
parent ff338dad60
commit 8b99e30132
4 changed files with 47 additions and 26 deletions

View File

@ -116,6 +116,7 @@ The `//` is very important, it's a terraform specific syntax used to separate gi
- [elasticsearch](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/elasticsearch/) - [elasticsearch](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/elasticsearch/)
- [mongodb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/mongodb/) - [mongodb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/mongodb/)
- [mysql](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/mysql/) - [mysql](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/mysql/)
- [postgresql](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/postgresql/)
- [redis](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/redis/) - [redis](https://bitbucket.org/morea/terraform.feature.datadog/src/master/database/redis/)
- [middleware](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/) - [middleware](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/)
- [apache](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/apache/) - [apache](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/apache/)

View File

@ -1,43 +1,57 @@
PostgreSQL DataDog monitors # DATABASE POSTGRESQL DataDog monitors
======================
How to use this module ## How to use this module
----------------------
``` ```
module "datadog-monitors-postgresql" { module "datadog-monitors-database-postgresql" {
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//databases/postgresql?ref={revision}" source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//database/postgresql?ref={revision}"
environment = "${var.environment}" environment = "${var.environment}"
message = "${module.datadog-message-alerting.alerting-message}" message = "${module.datadog-message-alerting.alerting-message}"
} }
``` ```
Purpose
-------
Creates DataDog monitors with the following checks :
* PostgreSQL not enough available connections ## Purpose
* PostgreSQL too many locks
Inputs Creates DataDog monitors with the following checks:
------
- PostgreSQL Connections
- PostgreSQL too many locks
## Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:| |------|-------------|:----:|:-----:|:-----:|
| delay | Delay in seconds for the metric evaluation | string | `15` | no |
| environment | Environment | string | - | yes | | environment | Environment | string | - | yes |
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | | evaluation_delay | Delay in seconds for the metric evaluation | string | `15` | no |
| 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 |
| message | Message sent when an alert is triggered | string | - | yes |
| new_host_delay | Delay in seconds for the metric evaluation | string | `300` | no |
| posgresql_lock_silenced | Groups to mute for PostgreSQL lock monitor | map | `<map>` | no |
| postgresql_connection_enabled | Flag to enable PostgreSQL connection monitor | string | `true` | no |
| postgresql_connection_extra_tags | Extra tags for PostgreSQL connection connects monitor | list | `<list>` | no |
| postgresql_connection_message | Custom message for PostgreSQL connection monitor | string | `` | no |
| postgresql_connection_silenced | Groups to mute for PostgreSQL connection monitor | map | `<map>` | no |
| postgresql_connection_threshold_critical | Maximum critical acceptable percent of connections | string | `80` | no | | postgresql_connection_threshold_critical | Maximum critical acceptable percent of connections | string | `80` | no |
| postgresql_connection_threshold_warning | Maximum warning acceptable percent of connections | string | `70` | no | | postgresql_connection_threshold_warning | Maximum warning acceptable percent of connections | string | `70` | no |
| postgresql_connection_silenced | Groups to mute for PostgreSQL connection monitor | map | `<map>` | no | | postgresql_connection_time_aggregator | Monitor time aggregator for PostgreSQL connection monitor [available values: min, max or avg] | string | `avg` | no |
| postgresql_connection_message | Custom message for PostgreSQL connection monitor | string | `` | no | | postgresql_connection_timeframe | Monitor timeframe for PostgreSQL connection monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no |
| postgresql_thread_threshold_critical | Maximum critical acceptable number of threads | string | `500` | no | | postgresql_lock_enabled | Flag to enable PostgreSQL lock monitor | string | `true` | no |
| postgresql_thread_threshold_warning | Maximum warning acceptable number of threads | string | `400` | no | | postgresql_lock_extra_tags | Extra tags for PostgreSQL lock connects monitor | list | `<list>` | no |
| postgresql_thread_silenced | Groups to mute for PostgreSQL threads monitor | map | `<map>` | no | | postgresql_lock_message | Custom message for PostgreSQL lock monitor | string | `` | no |
| postgresql_thread_message | Custom message for PostgreSQL thread monitor | string | `` | no | | postgresql_lock_threshold_critical | Maximum critical acceptable number of locks | string | `99` | no |
| message | Message sent when a monitor is triggered | string | - | yes | | postgresql_lock_threshold_warning | Maximum warning acceptable number of locks | string | `70` | no |
| postgresql_lock_time_aggregator | Monitor time aggregator for PostgreSQL lock monitor [available values: min, max or avg] | string | `min` | no |
| postgresql_lock_timeframe | Monitor timeframe for PostgreSQL lock monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_5m` | no |
## Outputs
| Name | Description |
|------|-------------|
| postgresql_connection_too_high_id | id for monitor postgresql_connection_too_high |
| postgresql_too_many_locks_id | id for monitor postgresql_too_many_locks |
Related documentation Related documentation
--------------------- ---------------------

View File

@ -79,7 +79,6 @@ variable "postgresql_connection_timeframe" {
default = "last_15m" default = "last_15m"
} }
############################ ############################
### PostgreSQL locks ### ### PostgreSQL locks ###
############################ ############################
@ -129,5 +128,3 @@ variable "postgresql_lock_timeframe" {
type = "string" type = "string"
default = "last_5m" default = "last_5m"
} }

View File

@ -0,0 +1,9 @@
output "postgresql_connection_too_high_id" {
description = "id for monitor postgresql_connection_too_high"
value = "${datadog_monitor.postgresql_connection_too_high.*.id}"
}
output "postgresql_too_many_locks_id" {
description = "id for monitor postgresql_too_many_locks"
value = "${datadog_monitor.postgresql_too_many_locks.*.id}"
}