Re: Postgres

153 views
Skip to first unread message
Message has been deleted

Brian Candler

unread,
Jun 20, 2022, 8:39:30 AM6/20/22
to Prometheus Users
https://github.com/prometheus-community/postgres_exporter#setting-the-postgres-servers-data-source-name
says:
"you can set a list of sources to scrape different instances from the one exporter setup. Just define a comma separated string."

I suggest you try that first.  If it doesn't work, then at worst you can run multiple instances of postgres_exporter bound to different ports.

On Monday, 20 June 2022 at 12:17:22 UTC+1 Vanshika Sahgal wrote:
How to monitor multiple postgres databases using postgres exporter and prometheus?
Message has been deleted

Brian Candler

unread,
Jun 20, 2022, 10:59:41 AM6/20/22
to Prometheus Users
> how will this allow alerting to be set up using prometheus?

The same as alerting always works with prometheus: you write alerting rules in prometheus, and connect it to alertmanager.

You'll need to look at the metrics being returned by the exporter, to decide what conditions you want to alert on, and write suitable alerting rules for those conditions.
Message has been deleted

Brian Candler

unread,
Jun 20, 2022, 12:05:35 PM6/20/22
to Prometheus Users
On Monday, 20 June 2022 at 16:30:46 UTC+1 Vanshika Sahgal wrote:
thanks and what about when i have the login and password for the different databases which are at different ports?

In general, a data source name looks like this:

postgresql://postgres:password@localhost:5432/postgres?sslmode=disable

As you can see, it can include username and password.  Have you tried specifying multiple data source names, separated by commas, in the same setting?

Brian Candler

unread,
Jun 20, 2022, 1:07:16 PM6/20/22
to Prometheus Users
Note that you can either use the URL format, or a connection string with attribute/value pairs like "user=pqgotest dbname=pqgotest sslmode=verify-full"

See:
Reply all
Reply to author
Forward
0 new messages