You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+87-19
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
8
8
Prometheus exporter for PostgreSQL server metrics.
9
9
10
-
CI Tested PostgreSQL versions: `10`, `11`, `12`, `13`, `14`, `15`
10
+
CI Tested PostgreSQL versions: `11`, `12`, `13`, `14`, `15`, `16`
11
11
12
12
## Quick Start
13
13
This package is available for Docker:
@@ -30,6 +30,26 @@ To use the multi-target functionality, send an http request to the endpoint `/pr
30
30
31
31
To avoid putting sensitive information like username and password in the URL, preconfigured auth modules are supported via the [auth_modules](#auth_modules) section of the config file. auth_modules for DSNs can be used with the `/probe` endpoint by specifying the `?auth_module=foo` http parameter.
32
32
33
+
Example Prometheus config:
34
+
```yaml
35
+
scrape_configs:
36
+
- job_name: 'postgres'
37
+
static_configs:
38
+
- targets:
39
+
- server1:5432
40
+
- server2:5432
41
+
metrics_path: /probe
42
+
params:
43
+
auth_module: [foo]
44
+
relabel_configs:
45
+
- source_labels: [__address__]
46
+
target_label: __param_target
47
+
- source_labels: [__param_target]
48
+
target_label: instance
49
+
- target_label: __address__
50
+
replacement: 127.0.0.1:9116 # The postgres exporter's real hostname:port.
51
+
```
52
+
33
53
## Configuration File
34
54
35
55
The configuration file controls the behavior of the exporter. It can be set using the `--config.file` command line flag and defaults to `postgres_exporter.yml`.
Whether to discover the databases on a server dynamically. Value can be `true` or `false`. Default is `false`.
175
241
176
242
* `PG_EXPORTER_EXTEND_QUERY_PATH`
177
243
Path to a YAML file containing custom queries to run. Check out [`queries.yaml`](queries.yaml)
178
244
for examples of the format.
179
245
180
-
* `PG_EXPORTER_CONSTANT_LABELS`
246
+
* `PG_EXPORTER_CONSTANT_LABELS` (DEPRECATED)
181
247
Labels to set in all metrics. A list of `label=value` pairs, separated by commas.
182
248
183
-
* `PG_EXPORTER_EXCLUDE_DATABASES`
249
+
* `PG_EXPORTER_EXCLUDE_DATABASES` (DEPRECATED)
184
250
A comma-separated list of databases to remove when autoDiscoverDatabases is enabled. Default is empty string.
185
251
186
-
* `PG_EXPORTER_INCLUDE_DATABASES`
252
+
* `PG_EXPORTER_INCLUDE_DATABASES` (DEPRECATED)
187
253
A comma-separated list of databases to only include when autoDiscoverDatabases is enabled. Default is empty string,
188
254
means allow all.
189
255
@@ -222,7 +288,9 @@ for l in StringIO(x):
222
288
Adjust the value of the resultant prometheus value type appropriately. This helps build
223
289
rich self-documenting metrics for the exporter.
224
290
225
-
### Adding new metrics via a config file
291
+
### Adding new metrics via a config file (DEPRECATED)
292
+
293
+
This feature is deprecated in favor of built-in collector functions. For generic SQL database monitoring see the [sql_exporter](https://github.com/burningalchemist/sql_exporter).
226
294
227
295
The -extend.query-path command-line argument specifies a YAML file containing additional queries to run.
228
296
Some examples are provided in [queries.yaml](queries.yaml).
@@ -233,7 +301,7 @@ or variants of postgres (e.g. Greenplum), you can disable the default metrics wi
233
301
flag. This removes all built-in metrics, and uses only metrics defined by queries in the `queries.yaml` file you supply
234
302
(so you must supply one, otherwise the exporter will return nothing but internal statuses and not your database).
235
303
236
-
### Automatically discover databases
304
+
### Automatically discover databases (DEPRECATED)
237
305
To scrape metrics from all databases on a database server, the database DSN's can be dynamically discovered via the
238
306
`--auto-discover-databases`flag. When true, `SELECT datname FROM pg_database WHERE datallowconn = true AND datistemplate = false and datname != current_database()` is run for all configured DSN's. From the
239
307
result a new set of DSN's is created for which the metrics are scraped.
0 commit comments