Skip to content

Postgres Exporter - custom_queries_config_path not working #7150

Open
@alebeta90

Description

@alebeta90

Hi,

I'm configuring grafana agent to export postgresql metrics. the basic configuration works.
Now I need to set a separate file with queries to collect some stats from the SQL queries, and it is not working, am receiving error:

May 07 09:11:24 db01 grafana-agent[2585743]: 2025/05/07 09:11:24 error loading config file /etc/grafana-agent.yaml: failed to unmarshal integration "postgres_exporter": yaml: unmarshal errors:
May 07 09:11:24 db01 grafana-agent[2585743]: line 17: field custom_queries_config_path not found

By checking the code, I can see the configuration does not have the custom_queries_config_path option available https://github.com/grafana/agent/blob/main/static/integrations/postgres_exporter/postgres_exporter.go#L20

But when reading documentation and a old issue in this repo there are some references to the usage of this option.

My current configuration looks as follow

postgres_exporter:
    enabled: {{ grafana_agent_postgres_enabled | lower }}
    instance: "{{ inventory_hostname }}"
    data_source_names:
      - "postgresql://{{ grafana_agent_postgres_user }}:{{ grafana_agent_postgres_password }}@{{ grafana_agent_postgres_host }}:{{ grafana_agent_postgres_port }}/postgres?sslmode=disable"
    autodiscover_databases: true
    # Use custom_queries_config_path for external queries file
    custom_queries_config_path: "/etc/grafana-agent-pg-queries.json"
    relabel_configs:
      - replacement: "{{ inventory_hostname }}"
        target_label: instance

it has some jinja vars because of ansible deployment.

Thanks in advance for any hint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-attentionAn issue or PR has been sitting around and needs attention.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions