[ZBX-20788] PostgreSQL template: decimal point and locale Created: 2022 Mar 23 Updated: 2024 Apr 10 Resolved: 2024 Mar 01 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Templates (T) |
Affects Version/s: | 6.0.2 |
Fix Version/s: | 6.0.28rc1, 6.4.13rc1, 7.0.0beta2, 7.0 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | Илья Демьянов | Assignee: | Denis Rasikhov |
Resolution: | Fixed | Votes: | 0 |
Labels: | Template_DB_PostgreSQL | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Debian GNU/Linux 11 |
Team: | |
Story Points: | 0.1 |
Description |
If set system locale like this $ cat /etc/default/locale LANG="en_US.UTF-8" LANGUAGE="en_US:UTF-8" LC_NUMERIC="ru_RU.UTF-8" LC_TIME="ru_RU.UTF-8" LC_MONETARY="ru_RU.UTF-8" LC_PAPER="ru_RU.UTF-8" LC_NAME="ru_RU.UTF-8" LC_ADDRESS="ru_RU.UTF-8" LC_TELEPHONE="ru_RU.UTF-8" LC_MEASUREMENT="ru_RU.UTF-8" LC_IDENTIFICATION="ru_RU.UTF-8" That results in the following error: 481432:20220323:173908.786 error reason for "Zabbix server:pgsql.ping.time["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]" changed: Preprocessing failed for: 1.Time: 0,424 ms 1. Failed: cannot perform regular expression "Time:\s+(\d+\.\d+)\s+ms" match for value of type "string": pattern does not match It looks like there was an attempt to fix this problem by adding the variable LANG=LANG=C.UTF-8 in the template_db_postgresql.conf file: However, it doesn't work in the current case:
$ LANG=C.UTF-8 psql -qtAX -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql"
1
Time: 0,340 ms
But:
$ LC_ALL=C.UTF-8 psql -qtAX -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql"
1
Time: 0.335 ms
Or even better:
$ LC_NUMERIC=C.UTF-8 psql -qtAX -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql"
1
Time: 0.335 ms
Should have changed LANG=C.UTF-8 to LC_NUMERIC=C.UTF-8. |
Comments |
Comment by Denis Rasikhov [ 2024 Feb 26 ] |
LC_NUMERIC will not change the output language in case if non-English locale is used by default, and will only change the fractional separator, so regex will not work in that case. So LC_ALL=C.UTF-8 to force both language and the separator is a better choice. |
Comment by Denis Rasikhov [ 2024 Mar 01 ] |
Fixed in:
|