centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
310 stars 274 forks source link

[os::windows::wsman::plugin updates] - JSON error #4461

Open antonin2063 opened 1 year ago

antonin2063 commented 1 year ago

Hello guys, Got an issue with the wsman plugin. Got an issue using the updates mode.

/usr/lib/centreon/centreon-plugins/src/centreon_plugins.pl --plugin=os::windows::wsman::plugin --mode=updates --hostname=xxx --wsman-scheme=xxx --wsman-port=xxxx --wsman-username='xxx' --wsman-password='xxx'

Got this return error : UNKNOWN: Cannot decode json response: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "PowerShell[.exe] [-P...") at /usr/lib/centreon/centreon-plugins/src/os/windows/wsman/mode/updates.pm line 96.

Has someone got an idea ? Thanks,

garnier-quentin commented 1 year ago

Could you provide the output with --debug-stream ?

antonin2063 commented 1 year ago

Got exactly the same output

/usr/lib/centreon/centreon-plugins/src/centreon_plugins.pl --plugin=os::windows::wsman::plugin --mode=updates --hostname=xx --wsman-scheme=xxx --wsman-port=xx --wsman-username='xx' --wsman-password='xx' --debug-stream

UNKNOWN: Cannot decode json response: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "PowerShell[.exe] [-P...") at /usr/lib/centreon/centreon-plugins/src/os/windows/wsman/mode/updates.pm line 96.

garnier-quentin commented 1 year ago

Could you add a debug in file update.pm to display the json response ?

antonin2063 commented 1 year ago

This is the JSON response, seems like a powershell issue..

UNKNOWN: Cannot decode json response: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "PowerShell[.exe] [-P...") at /usr/lib/centreon/centreon-plugins/src/os/windows/wsman/mode/updates.pm line 100. JSON Response:

PowerShell[.exe] [-PSConsoleFile | -Version ] [-NoLogo] [-NoExit] [-Sta][-Mta] [-NoProfile] [-NonInteractive] [-InputFormat {Text | XML}] [-OutputFormat {Text | XML}] [-WindowStyle