Created
January 27, 2020 21:59
-
-
Save burnsie7/ec008b0782d95d43c781170aaafaa3a9 to your computer and use it in GitHub Desktop.
Postgres yaml w/ custom and relations metrics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
init_config: | |
instances: | |
- host: localhost | |
port: 5432 | |
username: datadog | |
password: ***** | |
dbname: postgres | |
tags: | |
- application:ClickandCollect | |
collect_function_metrics: true | |
collect_count_metrics: true | |
collect_activity_metrics: true | |
collect_database_size_metrics: true | |
collect_default_database: true | |
tag_replication_role: false | |
relations: | |
- relation_regex: '.*' | |
custom_queries: | |
- metric_prefix: postgresql | |
query: SELECT datname, application_name, count(*) AS connection_state FROM pg_stat_activity GROUP BY datname, application_name, state HAVING COUNT(state) > 0; | |
columns: | |
- name: connection_state | |
type: gauge | |
- name: datname | |
type: tag | |
- name: application_name | |
type: tag | |
- metric_prefix: postgresql | |
query: SELECT datname, count(*) AS active_queries WHERE state='active' FROM pg_stat_activity_allusers GROUP BY datname; | |
columns: | |
- name: active_queries | |
type: gauge | |
- name: datname | |
type: tag | |
- metric_prefix: postgresql | |
query: SELECT datname, count(*) AS inactive_queries WHERE state!='active' FROM pg_stat_activity_allusers GROUP BY datname; | |
columns: | |
- name: inactive_queries | |
type: gauge | |
- name: datname | |
type: tag | |
# Additional Databases to collect relations (1) metrics. | |
- host: localhost | |
port: 5432 | |
username: datadog | |
password: ***** | |
dbname: <MY_DB_NAME> | |
tags: | |
- application:ClickandCollect | |
collect_function_metrics: true | |
collect_count_metrics: true | |
collect_activity_metrics: true | |
collect_database_size_metrics: true | |
collect_default_database: true | |
tag_replication_role: false | |
relations: | |
- relation_regex: '.*' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment