Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Unicode characters not handled correctly #124

Open
NotIMANot opened this issue Jan 26, 2023 · 2 comments
Open

Unicode characters not handled correctly #124

NotIMANot opened this issue Jan 26, 2023 · 2 comments
Labels

Comments

@NotIMANot
Copy link

NotIMANot commented Jan 26, 2023

Hi,

When listing datastore usage, Unicode characters are not decoded correctly.

# ./centreon_plugins.pl --plugin=apps::vmware::connector::plugin  --custommode=connector --connector-hostname=127.0.0.1 --container=default --verbose --mode=datastore-usage
OK: All datastores are ok | 'used_A-Logs'=11395923968B;;;0;21206401024 'free_A-Logs'=9810477056B;;;0;21206401024 'used_prct_A-Logs'=53.74%;;;0;100 'provisioned_A-Logs'=15505294989B;;;0;21206401024 'used_B-1'=298633396224B;;;0;536602476544 'free_B-1'=237969080320B;;;0;536602476544 'used_prct_B-1'=55.65%;;;0;100 'provisioned_B-1'=2530391118213B;;;0;536602476544 'used_C-1'=20589838336B;;;0;858725023744 'free_C-1'=838135185408B;;;0;858725023744 'used_prct_C-1'=2.40%;;;0;100 'provisioned_C-1'=91164125278B;;;0;858725023744 'used_D_Manag▒-1'=82683363328B;;;0;1648999006208 'free_D_Manag▒-1'=1566315642880B;;;0;1648999006208 'used_prct_D_Manag▒-1'=5.01%;;;0;100 'provisioned_D_Manag▒-1'=473536286612B;;;0;1648999006208 'used_local'=5034213376B;;;0;2000112582656 'free_local'=1995078369280B;;;0;2000112582656 'used_prct_local'=0.25%;;;0;100 'used_tmp-vm'=19217252352B;;;0;429228294144 'free_tmp-vm'=410011041792B;;;0;429228294144 'used_prct_tmp-vm'=4.48%;;;0;100 'provisioned_tmp-vm'=56432673307B;;;0;429228294144
Datastore 'A-Logs' accessible 1, Usage Total: 19.75 GB Used: 10.61 GB (53.74%) Free: 9.14 GB (46.26%), Provisioned: 14.44 GB (73.12%)
Datastore 'B-1' accessible 1, Usage Total: 499.75 GB Used: 278.12 GB (55.65%) Free: 221.63 GB (44.35%), Provisioned: 2.30 TB (471.56%)
Datastore 'C-1' accessible 1, Usage Total: 799.75 GB Used: 19.18 GB (2.40%) Free: 780.57 GB (97.60%), Provisioned: 84.90 GB (10.62%)
Datastore 'D_Manag▒-1' accessible 1, Usage Total: 1.50 TB Used: 77.00 GB (5.01%) Free: 1.42 TB (94.99%), Provisioned: 441.02 GB (28.72%)
Datastore 'local' accessible 1, Usage Total: 1.82 TB Used: 4.69 GB (0.25%) Free: 1.81 TB (99.75%)
Datastore 'tmp-vm' accessible 1, Usage Total: 399.75 GB Used: 17.90 GB (4.48%) Free: 381.85 GB (95.52%), Provisioned: 52.56 GB (13.15%)

In this example, datastore "D_Managé-1" is shown as "D_Manag▒-1"

Trying to filter this datastore in particular, brings up the same problem :

# ./centreon_plugins.pl --plugin=apps::vmware::connector::plugin  --custommode=connector --connector-hostname=127.0.0.1 --container=default --verbose --mode=datastore-usage --datastore-name='D_Managé-1'
UNKNOWN: Cannot find 'Datastore' object

Trying with the wrongly encoded character does the same :

# ./centreon_plugins.pl --plugin=apps::vmware::connector::plugin  --custommode=connector --connector-hostname=127.0.0.1 --container=default --verbose --mode=datastore-usage --datastore-name='D_Manag▒-1'
UNKNOWN: Cannot find 'Datastore' object

Filters on other datastores work great :

# ./centreon_plugins.pl --plugin=apps::vmware::connector::plugin  --custommode=connector --connector-hostname=127.0.0.1 --container=default --verbose --mode=datastore-usage --datastore-name='A-Logs'
OK: Datastore 'A-Logs' accessible 1, Usage Total: 19.75 GB Used: 10.61 GB (53.74%) Free: 9.14 GB (46.26%), Provisioned: 14.44 GB (73.12%) | 'used'=11396972544B;;;0;21206401024 'free'=9809428480B;;;0;21206401024 'used_prct'=53.74%;;;0;100 'provisioned'=15506343565B;;;0;21206401024
Datastore 'A-Logs' accessible 1, Usage Total: 19.75 GB Used: 10.61 GB (53.74%) Free: 9.14 GB (46.26%), Provisioned: 14.44 GB (73.12%)

In case it matters, my locales are all set to UTF8 :

# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

There is nothing related to this in the logs.

@garnier-quentin
Copy link
Contributor

You can cheat and use a regexp to filter the datastore with accent. Could you provide the result with --debug in a file ?

@NotIMANot
Copy link
Author

Cheating with regexp does work.
Result in a file attached.
result.txt

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants