Doc: Adds IWKB000019 for RegexErrors

This commit is contained in:
Lord Hepipud 2024-08-16 11:38:25 +02:00
parent 7dce5547db
commit 45514f66af
2 changed files with 28 additions and 0 deletions

View file

@ -26,3 +26,4 @@ For this reason you will find a list of Icinga knowledge base entries below. Ent
| [IWKB000016](knowledgebase/IWKB000016.md) | Checks using Performance Counter fail with various messages like `Exception of type 'System.OutOfMemoryException' was thrown` or `Icinga Invalid Configuration Error was thrown: PerfCounterCategoryMissing: Category "Memory" not found` |
| [IWKB000017](knowledgebase/IWKB000017.md) | Icinga throws exception during plugin execution after uninstalling SCOM or other vendor software using PowerShell modules |
| [IWKB000018](knowledgebase/IWKB000018.md) | Icinga for Windows services throws event id 1500 with error `Exception while calling AuthenticateAsServer: The credentials supplied to the package were not recognized` |
| [IWKB000019](knowledgebase/IWKB000019.md) | Icinga Invalid Input Error was thrown: RegexError |

View file

@ -0,0 +1,27 @@
# Icinga Knowledge Base - IWKB000019
## Short Message
Icinga Invalid Input Error was thrown: RegexError
## Example Exception
Icinga Invalid Input Error was thrown: RegexError
A request was not handled properly because a provided regex could not be interpreted. Please validate your regex and try again. In case you are trying to access a ressource containing [], you will have to escape each symbol by using \`. Example: myservice\`[\`]
## Reason
Icinga for Windows itself and most PowerShell Cmdlets will support to add regex expressions, like simple wildcards (`*`) or other terms into arguments for like `Path` or `Name`. Because of this behavior, a bracket `[]` will in some cases be interpreted as regex, but because of an invalid format, causing errors like the one above. This mostly happens in case you have service names or directories/files, containing such characters.
## Solution
While the directory check plugin for Icinga for Windows does the escaping in such cases automatically starting with version 1.13.0, because by providing a path regex is not really a concern for the plugin, there is a different story for examples like the service plugin.
In case you have a service called `mycustomservice[]`, you will run into the exception above. To mitigate this, you have to escape brackets with the backticks.
```powershell
Invoke-IcingaCheckService -Service 'mycustomservice`[`]';
```
Now your checks will run through as expected without any issues.