|
5 | 5 | # Parameters: |
6 | 6 | # $password |
7 | 7 | # The password for the datadog user |
8 | | -# $host: |
| 8 | +# $host |
9 | 9 | # The host postgres is running on |
10 | 10 | # $dbname |
11 | 11 | # The postgres database name |
|
18 | 18 | # $use_psycopg2 |
19 | 19 | # Boolean to flag connecting to postgres with psycopg2 instead of pg8000. |
20 | 20 | # Warning, psycopg2 doesn't support ssl mode. |
| 21 | +# $collect_function_metrics |
| 22 | +# Boolean to enable collecting metrics regarding PL/pgSQL functions from pg_stat_user_functions. |
| 23 | +# $collect_count_metrics |
| 24 | +# Boolean to enable collecting count metrics, default value is True for backward compatibility but they might be slow, |
| 25 | +# suggested value is False. |
| 26 | +# $collect_activity_metrics |
| 27 | +# Boolean to enable collecting metrics regarding transactions from pg_stat_activity, default value is False. |
| 28 | +# Please make sure the user has sufficient privileges to read from pg_stat_activity before enabling this option. |
| 29 | +# $collect_database_size_metrics |
| 30 | +# Boolean to enable collecting database size metrics. Default value is True but they might be slow with large databases |
| 31 | +# $collect_default_database |
| 32 | +# Boolean to enable collecting statistics from the default database 'postgres' in the check metrics, default to false |
21 | 33 | # $tags |
22 | 34 | # Optional array of tags |
23 | 35 | # $tables |
|
56 | 68 | # |
57 | 69 | class datadog_agent::integrations::postgres( |
58 | 70 | String $password, |
59 | | - String $host = 'localhost', |
60 | | - String $dbname = 'postgres', |
61 | | - Variant[String, Integer] $port = '5432', |
62 | | - String $username = 'datadog', |
63 | | - Boolean $ssl = false, |
64 | | - Boolean $use_psycopg2 = false, |
65 | | - Array[String] $tags = [], |
66 | | - Array[String] $tables = [], |
67 | | - Hash $custom_metrics = {}, |
68 | | - Optional[Array] $instances = undef, |
| 71 | + String $host = 'localhost', |
| 72 | + String $dbname = 'postgres', |
| 73 | + Variant[String, Integer] $port = '5432', |
| 74 | + String $username = 'datadog', |
| 75 | + Boolean $ssl = false, |
| 76 | + Boolean $use_psycopg2 = false, |
| 77 | + Boolean $collect_function_metrics = false, |
| 78 | + Boolean $collect_count_metrics = false, |
| 79 | + Boolean $collect_activity_metrics = false, |
| 80 | + Boolean $collect_database_size_metrics = false, |
| 81 | + Boolean $collect_default_database = false, |
| 82 | + Array[String] $tags = [], |
| 83 | + Array[String] $tables = [], |
| 84 | + Hash $custom_metrics = {}, |
| 85 | + Optional[Array] $instances = undef, |
69 | 86 | ) inherits datadog_agent::params { |
70 | 87 | include datadog_agent |
71 | 88 |
|
|
85 | 102 |
|
86 | 103 | if !$instances and $host { |
87 | 104 | $_instances = [{ |
88 | | - 'host' => $host, |
89 | | - 'password' => $password, |
90 | | - 'dbname' => $dbname, |
91 | | - 'port' => $port, |
92 | | - 'username' => $username, |
93 | | - 'ssl' => $ssl, |
94 | | - 'use_psycopg2' => $use_psycopg2, |
95 | | - 'tags' => $tags, |
96 | | - 'tables' => $tables, |
97 | | - 'custom_metrics' => $custom_metrics, |
| 105 | + 'host' => $host, |
| 106 | + 'password' => $password, |
| 107 | + 'dbname' => $dbname, |
| 108 | + 'port' => $port, |
| 109 | + 'username' => $username, |
| 110 | + 'ssl' => $ssl, |
| 111 | + 'use_psycopg2' => $use_psycopg2, |
| 112 | + 'tags' => $tags, |
| 113 | + 'tables' => $tables, |
| 114 | + 'custom_metrics' => $custom_metrics, |
| 115 | + 'collect_function_metrics' => $collect_function_metrics, |
| 116 | + 'collect_count_metrics' => $collect_count_metrics, |
| 117 | + 'collect_activity_metrics' => $collect_activity_metrics, |
| 118 | + 'collect_database_size_metrics' => $collect_database_size_metrics, |
| 119 | + 'collect_default_database' => $collect_default_database, |
98 | 120 | }] |
99 | 121 | } elsif !$instances{ |
100 | 122 | $_instances = [] |
|
0 commit comments