Icinga / icinga-powershell-plugins

A collection of Windows check plugins for the Icinga PowerShell Framework
GNU General Public License v2.0
51 stars 28 forks source link

Invoke-IcingaCheckCheckSum escape special chars in output #99

Open Mikesch-mp opened 4 years ago

Mikesch-mp commented 4 years ago

If you use a ful path for a file, the output maybe strange if it conains special chars . In icingaweb it get translated to tabs or other control characters.

Path for the file in the picture is C:\test\test.txt

grafik

LordHepipud commented 4 years ago

Hello,

Thank you for the issue. Sadly this is nothing the plugins can fix. There was a similar issue on Icinga Web 2 created, regarding \n: #4249.

As far as this issue goes, this is the expected behaviour of Icinga Web 2 while parsing plugin output.

Mikesch-mp commented 4 years ago

If the output gets correctly escaped it should be no problem. Dont get me wrong, but we all know that icingaweb2 sucks when it comes to special chars and its been always a fingerpointing between icinga2 (core), icingweb2 and plugin developers. With this knowledge the plugins that are made to use with icinga2 mainly should try to do their best to work with icingaweb2, knowing about the flaws over there.

Maybe add a switch to escape the output (the textpart only, not the perfdata) for\ and $ chars at least.

LordHepipud commented 4 years ago

I just talked with our Icinga Web 2 developers about this issue and they confirm there is no solution for this problem. Icinga Web 2 will always encode this characters into tabs and new lines. This is a historical issue, as some plugins relay on this to format their output properly.

The only solution for this specific plugin would be to transform \ into /, which makes path attributes still valid and get not replaced by Icinga Web 2.

image

How ever, this is not a generic solution and still can occure while running different checks, like Performance Counters, Scheduled Tasks, and so on.

I have no proper solution for this, neither has the Icinga Web team. If we bruteforce our way into this and no longer allow \ inside Icinga for Windows check outputs, it might cause other issues, because Performance Counter for example rely on the \ and I don't want to change the entire Framework to convert and handle everything. Because in the end, it might cause user confusion. Sure - this problem here also causes confusion, is in my oppinion how ever only occuring rarely.

I'm open for ideas and suggestions in this case.