[check_postgres] Checking PostgreSQL lock count

Thomas Güttler guettliml at thomas-guettler.de
Fri Dec 18 08:04:22 UTC 2015


Here I got this reply: http://dba.stackexchange.com/questions/123945/checking-postgresql-lock-count-with-check-postgres-pl

 > The only monitoring that would make sense to me is the duration of the locks (e.g. locks held for more than 5
 > minutes). Or the number of transactions waiting for a lock.


The answer came from someone who has a lot of postgres knowledge.

Now my question: How to implement this advice with check_postgres.pl?

Regards,
   Thomas Güttler

Am 17.12.2015 um 14:38 schrieb Thomas Güttler:
> Hi
>
> We use check_postgres.pl to monitor our database.
>
> We use this to check the count of the locks:
>
> https://bucardo.org/check_postgres/check_postgres.pl.html#locks
>
> We often see more than 150 locks.
>
> The question was: What is going on? We patched the script to output this sql statement, if the lock count was exceeded:
>
> select * from pg_stat_activity order by datname
>
> Unfortunately the result is not what I was expecting. Although there are more than 150 locks, pg_stat_activity shows
> only few (less then 10) queries.
>
> This has happened about twice a day during the last days, and every time only few lines where returned by pg_stat_activity.
>
> What is going on here?
>
> How can I further debug where these locks come from?
>
> BTW, same question here:
>
> http://dba.stackexchange.com/questions/123945/checking-postgresql-lock-count-with-check-postgres-pl
>

-- 
Thomas Guettler http://www.thomas-guettler.de/


More information about the Check_postgres mailing list