# DATABASE POSTGRESQL DataDog monitors ## How to use this module ``` module "datadog-monitors-database-postgresql" { source = "git::ssh://git@github.com/claranet/terraform-datadog-monitors.git//database/postgresql?ref={revision}" environment = var.environment message = module.datadog-message-alerting.alerting-message } ``` ## Purpose Creates DataDog monitors with the following checks: - PostgreSQL Connections - PostgreSQL server does not respond - PostgreSQL too many locks ## Inputs | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | environment | Environment | string | n/a | yes | | 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\_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 for the metric evaluation | string | `"300"` | no | | postgresql\_availability\_enabled | Flag to enable PostgreSQL availability monitor | string | `"true"` | no | | postgresql\_availability\_extra\_tags | Extra tags for PostgreSQL availability monitor | list(string) | `[]` | no | | postgresql\_availability\_message | Custom message for PostgreSQL availability monitor | string | `""` | no | | postgresql\_availability\_no\_data\_timeframe | PostgreSQL availability monitor no data timeframe | string | `"10"` | no | | postgresql\_availability\_threshold\_warning | PostgreSQL availability monitor (warning threshold) | string | `"3"` | 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(string) | `[]` | no | | postgresql\_connection\_message | Custom message for PostgreSQL connection monitor | string | `""` | 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\_time\_aggregator | Monitor time aggregator for PostgreSQL connection monitor [available values: min, max or avg] | string | `"avg"` | 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\_lock\_enabled | Flag to enable PostgreSQL lock monitor | string | `"true"` | no | | postgresql\_lock\_extra\_tags | Extra tags for PostgreSQL lock connects monitor | list(string) | `[]` | no | | postgresql\_lock\_message | Custom message for PostgreSQL lock monitor | string | `""` | no | | postgresql\_lock\_threshold\_critical | Maximum critical acceptable number of locks | string | `"99"` | no | | 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 | | prefix\_slug | Prefix string to prepend between brackets on every monitors names | string | `""` | no | ## Outputs | Name | Description | |------|-------------| | postgresql\_availability\_id | id for monitor postgresql_availability | | 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 DataDog documentation: [https://docs.datadoghq.com/integrations/postgres/](https://docs.datadoghq.com/integrations/postgres/)