jfcoz / postgresqltuner

Simple script to analyse your PostgreSQL database configuration, and give tuning advice
https://postgresqltuner.pl
GNU General Public License v3.0
2.61k stars 190 forks source link

Running in non-english locale fails #34

Closed metaminimalist closed 5 years ago

metaminimalist commented 6 years ago

Expected Behavior

It should work as advertised.

Current Behavior

memory related output is useless [INFO] OS total memory: 0 [UNKNOWN] OS total mem unknown : unable to analyse PostgreSQL memory usage

Possible Solution

run https://github.com/jfcoz/postgresqltuner/blob/a30c6194ee73191f75c5d0d1656d7284b319601e/postgresqltuner.pl#L254 (and possibly other external commands on other platforms) with LANG=C and LC_ALL=C settings, so that different localized message strings in the command's output do not render the matchstrings useless.

Running LANG=C LC_ALL=C postgresqltuner.pl --database <database_name> gives [INFO] OS total memory: 31.41 GB as well as

[INFO]    PostgreSQL maximum memory usage: 12.81% of system RAM
[WARN]    Max possible memory usage for PostgreSQL is less than 60% of system total RAM. On a dedicated host you can increase PostgreSQL buffers to optimize performances.
[INFO]    max memory+effective_cache_size is 25.54% of total RAM
[WARN]    Increase shared_buffers and/or effective_cache_size to use more memory

Steps to Reproduce (for bugs)

  1. log on to a linux DB host with de_DE.UTF-8 locale
  2. run postgresqltuner.pl --database
  3. find

[INFO] OS total memory: 0

as well as

[UNKNOWN] OS total mem unknown : unable to analyse PostgreSQL memory usage

in the output

Your Environment