File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,29 @@ docker run --net=host -it --rm -e POSTGRES_PASSWORD=password postgres
1717# Connect to it
1818docker run \
1919 --net=host \
20- -e DATA_SOURCE_NAME="postgresql://postgres:password@localhost:5432/postgres?sslmode=disable" \
20+ -e DATA_SOURCE_URI="localhost:5432/postgres?sslmode=disable" \
21+ -e DATA_SOURCE_USER=postgres \
22+ -e DATA_SOURCE_PASS=password \
2123 quay.io/prometheuscommunity/postgres-exporter
2224```
2325
26+ Test with:
27+ ``` bash
28+ curl " http://localhost:9187/metrics"
29+ ```
30+
31+ Example Prometheus config:
32+ ``` yaml
33+ scrape_configs :
34+ - job_name : postgres
35+ static_configs :
36+ - targets : ["127.0.0.1:9187"] # Replace IP with the hostname of the docker container if you're running the container in a separate network
37+ ` ` `
38+
39+ Now use the DATA_SOURCE_PASS_FILE with a mounted file containing the password to prevent having the password in an environment variable.
40+
41+ The container process runs with uid/gid 65534 (important for file permissions).
42+
2443## Multi-Target Support (BETA)
2544**This Feature is in beta and may require changes in future releases. Feedback is welcome.**
2645
@@ -208,7 +227,7 @@ The following environment variables configure the exporter:
208227* `DATA_SOURCE_URI`
209228 an alternative to `DATA_SOURCE_NAME` which exclusively accepts the hostname
210229 without a username and password component. For example, `my_pg_hostname` or
211- ` my_pg_hostname?sslmode=disable` .
230+ ` my_pg_hostname:5432/postgres ?sslmode=disable` .
212231
213232* `DATA_SOURCE_URI_FILE`
214233 The same as above but reads the URI from a file.
You can’t perform that action at this time.
0 commit comments