Vonng / pg_exporter

Advanced PostgreSQL & Pgbouncer Metrics Exporter for Prometheus
https://pigsty.io
Apache License 2.0
164 stars 42 forks source link

Allow to collect metrics from multiple sources #26

Open mjf opened 2 years ago

mjf commented 2 years ago

Hello. Thank you for the unique Postgres exporter first! :1st_place_medal: IMHO, it could be even a improved significantly (with maybe quite a low effort in Golang) if you added higher level of configuration allowing us to configure the exporter to collect metrics from multiple sources, distinquished by some "top level" configuration of either tags (eg. a hostname), metric prefix (eg pg1, pg2), or both of them.

I don't like the idea to have separated exporter instance running for every single Postgres server I happen to manage. Also some of the clusters are replicated across distant locations (which indeed asks for collecting metrics from far point or multiple points). Sometimes it's viable to run exporter on the same server as Postgres cluster and sometimes it would be really nice to monitor many Postgres instances belonging to a single cluster flared across various providers etc. from a single point.

Side note:

I also play with some (vague yet) idea that having data from a replicated cluster collected from one place could lead to even further development of the exporter (eg. so that we could use collected metrics in some sort of templating of the probes to gain additional flexibility and dynamicity of the monitoring process, or to slow down collecting in case of certain conditions, or to add something like priority queue to the scheduler, or perhaps even writting some results back to the database in a "loop" or to completely different database from the monitored ones (well, it's just SQL and if it was templated as well as if the check paramethers were templated base on some measurements then...)

:grin:

AFAIK, no Postgres collector is so finely grained as this one and also no I know of allows to collect metrics from multiple sources at once and make some use of the fact (if nothing else then at least "administratively" or saving overall resources). Therefor I think it can be a great improvement. Thank you.