prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.83k stars 745 forks source link

Excluding database from collecting metric doesn't work #982

Closed SergeiCherevko closed 11 months ago

SergeiCherevko commented 11 months ago

What did you do?

I tried to use

--exclude-databases name_db

What did you expect to see?

Stop collecting metrics from excluded db

What did you see instead? Under which circumstances?

postgres_exporter: error: unknown long flag '--exclude-databases healthbeat', try --help

Environment

version: '3.5'

services:
  pg_exporter:
    image: "bitnami/postgres-exporter:0.15.0"
    container_name: postgres_exporter
    hostname: postgres_exporter
    restart: unless-stopped
    network_mode: host
    command:
      - '--web.listen-address=:9630'
      - '--auto-discover-databases'
      - '--exclude-databases healthbeat'
    volumes:
      - /opt/pg_exporter/extra.yml:/opt/bitnami/postgres-exporter/extra.yml:ro
    environment:
      DATA_SOURCE_NAME: postgresql://{{ postgres_exporter }}:{{ postgres_exporter_password }}@{{ inventory_hostname }}:{{ postgres_port }}/{{ postgres_db }}?sslmode=disable
      PG_EXPORTER_EXTEND_QUERY_PATH: /opt/bitnami/postgres-exporter/extra.yml
      - '--web.listen-address=:9630'
      - '--auto-discover-databases'
      - '--exclude-databases healthbeat'
SergeiCherevko commented 11 months ago

This also doesn't work

- '--collector.database.exclude-databases healthbeat'
SergeiCherevko commented 11 months ago

sorry i think i should to add equal

--exclude-databases=healthbeat

But what about deprecating?

How to exclude database when developers delete this key?

eliliam commented 5 months ago

I am wondering the same thing, @sysadmind could you please provide some context as to what to use instead of --exclude-databases since that is deprecated?