diff options
author | Joshua Tolley | 2010-08-30 14:04:40 +0000 |
---|---|---|
committer | Joshua Tolley | 2010-08-30 14:04:40 +0000 |
commit | 73267d8da17ba4c207950463ee458338a70273a1 (patch) | |
tree | bf7656694bb6ef28efdb7149b9e9aa58bdedfdd1 /check_postgres.pl | |
parent | 8e4d9aed7e6f336b4cabede863dfc1e3f026b678 (diff) |
Fix txn_time to work properly given psql with -x
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-x | check_postgres.pl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/check_postgres.pl b/check_postgres.pl index e4f885ce6..424b23960 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -6851,14 +6851,14 @@ SELECT client_addr, client_port, procpid, - ROUND(EXTRACT(epoch FROM now()-xact_start)), + ROUND(EXTRACT(epoch FROM now()-xact_start)) AS maxtime, datname, usename FROM pg_stat_activity WHERE xact_start IS NOT NULL $USERWHERECLAUSE }; - my $info = run_command($SQL, { regex => qr{\d+ \|\s+\s+}, emptyok => 1 } ); + my $info = run_command($SQL, { regex => qr{\| \d+\n}, emptyok => 1 } ); $db = $info->{db}[0]; my $slurp = $db->{slurp}; @@ -6878,7 +6878,7 @@ WHERE xact_start IS NOT NULL $USERWHERECLAUSE ## Read in and parse the psql output for my $r (@{$db->{slurp}}) { - my ($add,$port,$pid,$time,$dbname,$user) = @$r{qw/ client_addr client_port procpid username maxtime maxdb /}; + my ($add,$port,$pid,$time,$dbname,$user) = @$r{qw/ client_addr client_port procpid maxtime datname usename /}; next if skip_item($dbname); if ($time >= $maxtime) { |