I have a custom Powershell script called by Nagios using "check_nrpe". Currently all check results output messages with special characters like 'è', 'é' or 'à' are not displayed properly when the check result is shown on Nagios.
How to allow those to be displayed properly?
Check command
$USER1$/check_nrpe -H server.tld -c check_foo -a 7 7 7
Script call on nsclient.ini
[/settings/external scripts/scripts]
check_foo = cmd /c echo X:\scripts_\check-foo.ps1 -arg1 "$ARG1$" -arg2 "$ARG2$" -arg3 "$ARG3$"; exit($lastexitcode) | powershell.exe -command -
Expected result
CRITICAL - Vérification échouée
Actual result
# UTF-8 BOM (GUI)
CRITICAL - Vrification choue
# UTF-8 BOM (CLI)
CRITICAL - V,rification ,choue,
# UTF-8 (GUI)
CRITICAL - VǸrification ǸchoueǸ
Currently my Powershell script is remotely called with "check_nrpe" from the Linux CentOS 7 monitoring machine and NSClient++ on the target server (Windows 2016 Server). The script itelf is encoded as "UTF-8 BOM".
Best Answer
disable your nsclient.ini encoding utf8
in your script use
output your result with : (instead of write-output or write-host)
works for me pick up from here