postgres_exporter icon indicating copy to clipboard operation
postgres_exporter copied to clipboard

Docs on use of flags in combination with config.file non-existent

Open camac2025 opened this issue 2 months ago • 1 comments

What did you do? Create a file called postgres_exporter.yml alongside the binary i.e. in same directory. Populated it with a variety of combinations of:

collector.postmaster collector.stat_checkpointer

or

--collector.postmaster  
--collector.stat_checkpointer

trying different spaces, newlines, dashes etc. etc.

What did you expect to see? I expected to see the file be located and my supplied flags be applied.

What did you see instead? Under which circumstances? Initially when using systemctl wrapper under rocky 9 I saw:

"Error loading config" err="Error opening config file \"postgres_exporter.yml\": open postgres_exporter.yml: no such file or directory"

So I assumed there was something wrong with execution environment as setup by systemd and I tried an explicit call - this resulted in unmarshalling errors, suggesting to my not-very-go-aware mind that I have the format wrong..?

$ ./postgres_exporter --config.file=./postgres_exporter.yml
time=2025-10-28T18:28:17.679Z level=WARN source=main.go:85 msg="Error loading config" err="Error parsing config file \"./postgres_exporter.yml\": yaml: unmarshal errors:\n  line 1: cannot unmarshal !!str `collect...` into config.Config"

Environment

  • System information:
Linux 5.14.0-570.32.1.el9_6.x86_64 x86_64
  • postgres_exporter version:
postgres_exporter, version 0.17.1 (branch: HEAD, revision: 1e574cf4fd2a75a8a707d424eafcaa0b88cb7af4)
  build user:       root@b0ba132eddb0
  build date:       20250226-13:53:15
  go version:       go1.23.6
  platform:         linux/amd64
  tags:             unknown
  • postgres_exporter flags: Well, I was hoping for these!
--collector.postmaster 
--collector.stat_checkpointer
  • PostgreSQL version:
 PostgreSQL 17.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5), 64-bit
  • Logs:
insert logs relevant to the issue here

I really think the docs need an example of how to set up a config.file incorporating flags, assuming that is possible and I do not need to edit my systemd service script to add explicit CLI options.

camac2025 avatar Oct 28 '25 18:10 camac2025

There is a pretty low hit rate for responses to issues in this repo.. I guess I'll hit stackoverflow or postgres-l but it seems a shame that such an important exporter has such a dispersed community. Any suggestions for better forums welcome. If I get an answer to this I am happy to raise a docs PR.

camac2025 avatar Oct 30 '25 18:10 camac2025