Hi I want to calculate Postgres locks using Postgres exporter, I found this template here <https://awesome-prometheus-alerts.grep.to/rules> : - alert: PostgresqlTooManyLocksAcquired expr: ((sum (pg_locks_count)) / (pg_settings_max_locks_per_transaction * pg_settings_max_connections)) > 0.20 for: 5m labels: severity: critical annotations: summary: "Postgresql too many locks acquired (instance {{ $labels.instance }})" description: "Too many locks acquired on the database. If this alert happens frequently, we may need to increase the postgres setting max_locks_per_transaction.\n VALUE = {{ $value }}\n LABELS: {{ $labels }}"
the problem is, pg_locks_count counts all the locks on all of my Postgres instances and pg_settings_max_locks_per_transaction * pg_settings_max_connections shows the result per each Postgres host. So I don't get any result, I've Also tried this query: ((sum (pg_locks_count)) / (pg_settings_max_locks_per_transaction * pg_settings_max_connections)) by (instance) and ((sum (pg_locks_count)by (instance)) / (pg_settings_max_locks_per_transaction * pg_settings_max_connections)) But none of them works (I guess it is because of many to many division) How can I get this result per instance? -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/9ffef061-e5d9-477d-8ee4-c6649396e21ao%40googlegroups.com.

