Fix get_bloat for Windows and use PGPASSFILE
Thisis a recreation of https://github.com/Checkmk/checkmk/pull/560
Bug reports
Please include:
- Your operating system name and version Windows Server 2019
- Detailed steps to reproduce the bug
-
use more than 3 Postgres DBs Then the get_bloat crashes with "The command line is too long."
-
Set a System Environment Variable for the PGPASSFILE It get's overwritten by an empty String
Proposed changes
This commit fixes two issue.
-
The get_bloat executes psql for each database. This is necessary because otherwise it exceeds the maximum 8191 characters limit of windows https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation Which triggers the error "The command line is too long." I observed it with 3 databases
-
The PGPASSFILE Env varaible is only overwritten by the instance pg_passfile when it is not empty. In this way it is possible to use a system wide PGPASSFILE evnironment variable.