Metric enrichment
Hi. I just started using the latest postgres_exporter in k8s. And it's cool! But I have one issue. I am using single pod in k8s with the env DATA_SOURCE_NAME with two different hosts and DBs:
env:
- name: DATA_SOURCE_NAME
value: "host=host1 port=5432 dbname=db1 user=user1 sslmode=disable,host=host2 port=5432 dbname=db2 user=user2 sslmode=disable"
I want to monitor just availability of DB's using "pg_exporter_last_scrape_error" or "pg_up". But this metrics don't have the DB and hostname in it's data like "pg_locks_count":
# HELP pg_exporter_last_scrape_error Whether the last scrape of metrics from PostgreSQL resulted in an error (1 for error, 0 for success).
# TYPE pg_exporter_last_scrape_error gauge
pg_exporter_last_scrape_error 0
# HELP pg_up Whether the last scrape of metrics from PostgreSQL was able to connect to the server (1 for yes, 0 for no).
# TYPE pg_up gauge
pg_up 1
# HELP pg_locks_count Number of locks
# TYPE pg_locks_count gauge
pg_locks_count{datname="db1",mode="accessexclusivelock",server="host1:5432"} 0
For example, I want to alert if one of DB's can't be accessed (pg_exporter_last_scrape_error returns 1). But how can I add the "broken" DB and host name to the alert if metric doesn't have that info? #452 is about the same issue
pg_up predates multi-host support, and I guess got missed when that was added.
pg_up predates multi-host support, and I guess got missed when that was added.
And so what?)
Link to this one #115 I definitely need this feature :-) ! Currently I'm using two postgres_exporter instances (with two services) just because of this problem. The "server" parameter need to be implemented to the pg_up metric.
Thank's for your work, postgres_exporter is a really nice soft !