|
| 1 | +version: '3.5' |
| 2 | + |
| 3 | +networks: |
| 4 | + default: |
| 5 | + external: true |
| 6 | + name: swarmstack_net |
| 7 | + |
| 8 | +configs: |
| 9 | + |
| 10 | + postgres_exporter_config: |
| 11 | + file: ./queries.yaml |
| 12 | + |
| 13 | + #postgres92_exporter_config: |
| 14 | + # file: ./queries92.yaml |
| 15 | + |
| 16 | +services: |
| 17 | + |
| 18 | + # Example for PostgreSQL 9.4 or later host |
| 19 | + postgres-exporter-pgserver94: |
| 20 | + image: wrouesnel/postgres_exporter:latest |
| 21 | + configs: |
| 22 | + - source: postgres_exporter_config |
| 23 | + target: /etc/postgres_exporter/queries.yaml |
| 24 | + deploy: |
| 25 | + # recommend static scrape target rather than swarm-discovery via labels below so that you can scrape less often |
| 26 | + #labels: |
| 27 | + # prometheus.enable: "true" |
| 28 | + # prometheus.port: "9187" |
| 29 | + # prometheus.path: "/metrics" |
| 30 | + mode: replicated |
| 31 | + replicas: 1 |
| 32 | + environment: |
| 33 | + - DATA_SOURCE_NAME=postgresql://postgres@pgserver94.example.com:5432/postgres?sslmode=disable |
| 34 | + - PG_EXPORTER_EXTEND_QUERY_PATH=/etc/postgres_exporter/queries.yaml |
| 35 | + |
| 36 | + # Example for older PostgreSQL 9.2 |
| 37 | + #postgres-exporter-pgserver92: |
| 38 | + # image: wrouesnel/postgres_exporter:latest |
| 39 | + # configs: |
| 40 | + # - source: postgres92_exporter_config |
| 41 | + # target: /etc/postgres_exporter/queries.yaml |
| 42 | + # deploy: |
| 43 | + # # recommend static scrape target rather than swarm-discovery via labels below so that you can scrape less often |
| 44 | + # #labels: |
| 45 | + # # prometheus.enable: "true" |
| 46 | + # # prometheus.port: "9187" |
| 47 | + # # prometheus.path: "/metrics" |
| 48 | + # mode: replicated |
| 49 | + # replicas: 1 |
| 50 | + # environment: |
| 51 | + # - DATA_SOURCE_NAME=postgresql://postgres@pgserver92.example.com:5432/postgres?sslmode=disable |
| 52 | + # - PG_EXPORTER_EXTEND_QUERY_PATH=/etc/postgres_exporter/queries.yaml |
| 53 | + # - PG_EXPORTER_DISABLE_DEFAULT_METRICS=true |
0 commit comments