Skip to content

Postgres Exporter - custom_queries_config_path not working #7150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alebeta90 opened this issue May 7, 2025 · 0 comments
Open

Postgres Exporter - custom_queries_config_path not working #7150

alebeta90 opened this issue May 7, 2025 · 0 comments

Comments

@alebeta90
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant