Up to now we used check_postgres.pl to monitor our database.

We used 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.

I was told this in a different question: [How to Debug check_postgresql][1]

> A single DML statement can easily obtain millions of locks. There is no 
> relation to the number of statements and the number of locks. But why are 
> 150 locks a bad thing? Unless they are held for a long time (minutes, 
> hours) I don't see any reason to check this.

How can I check for the lock count and ignore all locks which are only N seconds old?



  [1]: https://dba.stackexchange.com/questions/123945/checking-postgresql-lock-count-with-check-postgres-pl