Skip to content

Problem decoding accentuated characters from powershell output in centreon_nsclient_restapi.pl #5414

Open
@gehasia

Description

@gehasia

Hi,

I don't know if it belongs to this codebase or another, as i don't really understand how everything fits in what repo (does the perl serverside module for centreon belongs to here, i don't find it ? centreon_nsclient_restapi.pl --plugin=apps::nsclient::restapi::plugin )...

The problem seems to be a generic one, but i have it with this particular plugin clientside :
apps::microsoft::exchange::local::plugin

The perl script is called with those arguments serverside :
/usr/lib/centreon/plugins//centreon_nsclient_restapi.pl --plugin=apps::nsclient::restapi::plugin --mode=query --hostname='MYIPADDRESS' --port='8443' --proto='https' --legacy-password='MYSECRET' --command=check_centreon_plugins --arg='apps::microsoft::exchange::local::plugin' --arg='queues' --arg=' --warning-status="" --critical-status="not %{status} =~ /Ready|Active/i" --verbose' --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE" --timeout=30

I get this response :
UNKNOWN: Cannot decode json response: malformed UTF-8 character in JSON string, at character offset 2020 (before "\x{fffd}0080\\u009Ap...") at /usr/lib/centreon/plugins//centreon_nsclient_restapi.pl line 162.

Sure, if i check the nsclient plugin from the client side it check the Exchange Queue with the powershell command. Here is the problem, powershell reply with this in my case (my server is in French, so Exchange does some automatic translations...)

Get-Queue | fl
RunspaceId                       : 92b0f10a-cd46-42e8-9ffe-e7df26dc5519
DeliveryType                     : Undefined
NextHopDomain                    : Dépôt
TlsDomain                        :
NextHopConnector                 : 00000000-0000-0000-0000-000000000000
...

As you can see the NextHopDomain is "Dépôt" which contains accentuated characters which are not correctly handled by json_decode in
centreon_nsclient_restapi.pl

As it belongs to the base script centreon_nsclient_restapi.pl, i'm pretty sure that any accentuated characters sended in UTF-8 via json to the perl script will crash the same way, not only exchange plugins.

In general i try to do a PR with the issue as i tend to try to debug fully. But i'm new to this project, i don't really get which script has to handle thie case for the moment, nor i have any knowledge in perl (litteraly 0)...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions