I would like to ask a question when determining the amount of locks on a postgresql database.
Currently we are monitoring over 100 Postgresql databases and one of the things we monitor is the database locks.
On all the systems the amount of locks is not that high, however the most busy and production server always have over 500 locks.
Upon investigation, it seems that all the locks reported are access share locks which from what I understand will be there due to the amount of reads from the database.
Currently we are using the following method to retrieve the amount of database locks :
for i in `psql -t -c "select datname from pg_catalog.pg_database d" | grep -v template0 | grep -v template1`; do check_postgres.pl --action=locks --db=$i ; done
Check_postgres.pl is the monitoring tool we donwloaded in order to assist in monitoring the databases and we are also planning to use this within the nagios setup soon.
I would like to know whether someone has a better way of retrieving the amount of locks which are truly critical to monitor or perhaps even a way to exclude the access share locks from this.