[check_postgres] Could not parse psql output! on windows
Lord, David
d.lord at cgi.com
Tue Jan 10 10:58:39 UTC 2017
Greg,
Thanks for the reply. I think it is treating the carriage return as an empty extra line so this change fixes it:
bash.exe"-3.1$ diff check_postgres-v2.22.0.pl check_postgres.pl
2458a2459,2461
> ## Remove carriage returns
> $db->{slurp} =~ s/\r//g;
>
Regards
--
David Lord
-----Original Message-----
From: Greg Sabino Mullane [mailto:greg at endpoint.com]
Sent: 08 January 2017 19:50
To: Lord, David
Cc: check_postgres at bucardo.org
Subject: Re: [check_postgres] Could not parse psql output! on windows
> Command: c:\PostgreSQL\9.6\bin\psql.EXE -q -t -d postgres -U postgres -p 5432 -h localhost -o C:\Users\lordd\AppData\Local\Temp\K6ZyqKj_pv\check_postgres_psql.XHwQzkt.tmp -x -c "BEGIN;SET statement_timeout=30000;COMMIT;SELECT version() AS version"
> Full output: $POSTGRES1 = "version | PostgreSQL 9.6.1, compiled by
> Visual C++ build 1800, 32-bit\r\n\r\n";
That's unusual. That line should be triggering the regex around line 2469:
if ($line =~ /^ ?([\?\w]+)\s+\| (.*?)\s*$/) {
$stuff[$lnum]{$1} = $2;
$lastval = $1;
}
Certainly the outpute above matches that regex, but something about Windows is preventing it from doing so. It's been a long time since I did any serious Perl work on Windows, but try adding this above lone
2469 (above):
$line =~ s/\r//g;
--
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8
More information about the Check_postgres
mailing list