[ZBX-11512] Zabbix agent is affected by number separators Created: 2016 Nov 22 Updated: 2017 Nov 23 Resolved: 2016 Dec 13 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G) |
Affects Version/s: | 2.2.15, 3.0.5, 3.2.1 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | Alexey Pustovalov | Assignee: | Unassigned |
Resolution: | Cannot Reproduce | Votes: | 0 |
Labels: | locale | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Linux |
Attachments: |
![]() ![]() |
||||
Issue Links: |
|
Description |
Depends on LANG in OS, number separator could be comma or dot. Zabbix does not work with commas. For example, lv_LV and ru_RU use default number separator as comma. Received value [97,677710] is not suitable for value type [Numeric (float)] |
Comments |
Comment by Alexey Pustovalov [ 2016 Nov 22 ] |
$ printf "test %f\n" 0,214 test 0,214000 $ env | grep LC_NU LC_NUMERIC=da_DK $ unset LC_NUMERIC $ printf "test %f\n" 0,214 -bash: printf: 0,214: invalid number test 0.000000 $ printf "test %f\n" 0.214 test 0.214000
|
Comment by richlv [ 2016 Nov 22 ] |
ha, i mentioned that on my zabbixconf talk this year but that's not a zabbix agent problem directly, is it ? not much could be done besides setting locale in the initscripts or making zabbix accept comma (optionally) edit : ah, just accepting the comma would not be enough as the separators could still mess up everything... |
Comment by Aleksandrs Saveljevs [ 2016 Dec 13 ] |
Could not reproduce the problem so far. Variables LC_XXX have no effect without a call to setlocale(), but we do not invoke setlocale() ourselves. wiper and glebs.ivanovskis had an idea that setlocale() may be called by a library or a module that Zabbix agent uses. In order to find this out, they have prepared setlocale.c file (and an accompanying num_locale.c for testing, see attached). In order to use this file, first compile the shared library from setlocale.c: $ gcc setlocale.c -shared -fPIC -o setlocale.so -ldl The purpose of this shared library is to track calls to setlocale(). So the next step would be to launch a Zabbix agent or another Zabbix binary as follows: $ LD_PRELOAD=/path/to/setlocale.so zabbix_agentd ... If there are any calls to setlocale(), they should appear in the Zabbix log file. Here is an example of how it should look like using num_locale.c file: $ gcc num_locale.c -o num_locale $ LD_PRELOAD=./setlocale.so ./num_locale Probing environment variable LC_NUMERIC... System locale is: "(null)" Probing runtime locale settings........... setlocale(1, "(null)") = "C" ./setlocale.so(+0x8d2)[0x7fde422078d2] ./setlocale.so(+0x945)[0x7fde42207945] ./setlocale.so(setlocale+0x27)[0x7fde4220796e] ./num_locale[0x400677] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fde41e7db45] ./num_locale[0x400559] Runtime locale is: "C"; numbers look like: 1234567.8900 Setting runtime locale from environment... setlocale(1, "") = "ru_RU.utf8" ./setlocale.so(+0x8d2)[0x7fde422078d2] ./setlocale.so(setlocale+0x27)[0x7fde4220796e] ./num_locale[0x4006c2] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fde41e7db45] ./num_locale[0x400559] Runtime locale is: "ru_RU.utf8"; numbers look like: 1 234 567,8900 |
Comment by Aleksandrs Saveljevs [ 2016 Dec 13 ] |
If the issue appears again, we can use the method documented above to investigate. For now, this issue should be closed as "Cannot Reproduce". |
Comment by Aleksandrs Saveljevs [ 2016 Dec 13 ] |
It does not seem to be mentioned in the issue description, but values like 97,677710 are returned by built-in items like system.cpu.util[]. |
Comment by Glebs Ivanovskis (Inactive) [ 2017 Aug 10 ] |
|
Comment by Glebs Ivanovskis (Inactive) [ 2017 Nov 23 ] |
|