From 9b17f1e84ca0ac9e0656180ea90aff267abe5597 Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Wed, 11 Sep 2013 17:46:38 +0200 Subject: [PATCH] Fix issue in check_locks action. Previsouly, locks on transaction wasn't considered. Locks on "virtualxid" are explicitly exluded from results. --- check_postgres.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/check_postgres.pl b/check_postgres.pl index b7c8417d..e0eff63b 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -5057,8 +5057,15 @@ sub check_locks { default_critical => 150, }); - $SQL = q{SELECT granted, mode, datname FROM pg_locks l RIGHT JOIN pg_database d ON (d.oid=l.database) WHERE d.datallowconn}; - my $info = run_command($SQL, { regex => qr[\s*\w+\s*\|\s*] }); + $SQL = q{SELECT granted, mode, d.datname}. + q{ FROM pg_database d}. + q{ LEFT JOIN pg_stat_activity a ON (d.datname=a.datname)}. + q{ LEFT JOIN pg_locks l ON (l.pid = a.procpid)}. + q{ WHERE d.datallowconn}. + q{ AND COALESCE(l.locktype,'') <> 'virtualxid'}; + my $SQL92; + ($SQL92 = $SQL) =~ s/procpid/pid/; + my $info = run_command($SQL, { regex => qr[\s*\w+\s*\|\s*], version => [">9.1 $SQL92"] }); # Locks are counted globally not by db. # We output for each db, following the specific warning and critical : pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy