Description
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.