Hi there,
I coded a powershell script for local checks, basically it’s working.
But there are two ugly flaws:
First, I cannot use umlauts in the output message. Does anyone know how to set the output encoding for check_mk?
In the documentation I found, that the service name must be quoted, when white spaces are used. But when adding them, I get Invalid performance data: u’Service’
Write-Output “0 "My Service" Woche=$week $message” ->gives error
using Write-Output “0 My_Service Woche=$week $message” ->works fine
Calling from Powershell it looks correct.
Maybe both issues have the same cause, so I did not split the request.
Local check with space and umlauts.
There is only on important thing to do for your Powershell script. It must be saved as UTF8 with BOM.
The shown output is produced with this simple script
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
Write-Host('0 "Local Check" - UTF8 Coding Mit Umlauten Ä Ü Ö ä ü ö')
The first line is also important.
Working is this on my systems with Powershell 5.1
Starting with Powershell Core 6 you don’t need to do these things with file saved as. The system then outputs every time UTF-8 without BOM.
On my Powershell 7 systems only the write-host line is needed no extras.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.