Fix: Icinga Managed User lookup time
Fixes the lookup time if a user is managed by Icinga for Windows or not in large Active Directory environments, by using \`Get\-LocalUser\` instead.
This Cmdlet is available starting with PowerShell 5.0 and later and only required in general for running Icinga for Windows in JEA context. As JEA is only supported starting with PowerShell 5.0 or later, this will not cause any problems.
In case the command is executed on an older system without the \`Get\-LocalUser\` Cmdlet available, Icinga for Windows will handle all users tested with the new implementation as \`not\` managed by Icinga for Windows.
Feature: Adds exception report
Adds a new feature to EventLog writer, allowing to parse an exception report to identity the exact root cause and location, on where the error occurred in first place.
Feature: Allow Force-Creation of certificates for Agent over IMC
Adds support to re\-create the Icinga Agent certificates, even when they are already present on the system. This will resolve the manual requirement to delete the folder or certificates, in case the Icinga CA changes for example
Fix: Sync-IcingaRepository can cause invalid JSON primitive
By using the \`Sync\-IcingaRepository\` function, it might happen that in case the parent site is returning a file listing instead of an error page, the downloaded \*\*repository\*\* file is only the list of the files and not the proper JSON repo file.
Instead we now check the result properly and fallback by adding \`ifw.repo.json\` as it was intended before.
Fix: Version splitting returns "mayor" instead of "major"
Fixes the output value from \`Split\-IcingaVersion\` by returning the object \`major\` in addition to the wrong value \`mayor\`.
We will keep both outputs present for the moment, allowing developers to update their code.
Fix: Username has no length cap for JEA installation
JEA profile installation can fail and cause the Icinga Agent to become defective, in case a username is used being longer than 20 digits.
Fix: Icinga for Windows memory leak
In some scenarios, Icinga for Windows can contain a memory leak, caused by a bug of the Garbage Collector in older PowerShell versions.
We resolve this by enforcing a more aggressive approach on memory cleanup and by collecting all objects being used.
Fix: Performance for Add-Type testing
With recent versions we added a feature to test if Add-Type functions are added to the current PowerShell session, ensuring that the same type is not re-added which caused errors on the error stack.
While the code works perfectly fine, it takes a long time for execution which causes the plugin `Invoke-IcingaCheckDiskHealth` for example, to take way longer than usual.
This PR prepares the future `Private` and `Public` section of the Icinga for Windows environment variables and adds an internal, quick test if a Add-Type function is already added to the current session, once being tested with the old behaviour.
This reduces the disk health plugin execution time after the first run from around 10 seconds to 2 seconds.
Fix: Removes unnecessary module import
Removes not required import of PowerShell modules for `Invoke-IcingaNamespaceCmdlets`, as by the time we fetch the content the specified module must be loaded already.
In addition adds proper error output in case something goes wrong. Errors are written directly into the EventLog.
Fix: Memory leak on EventLog reader
With Icinga for Windows v1.7.0 we introdocued a way to read EventLog entries as stream directly into the CLI.
If used for a long time, the memory consumption of this active shell will increase over time, as the Garbage Collector does not kick in.
This will fix the issue by forcing the GC to be called after each loop cycle.
Fix: Repo hash generator causes file hashes to never compare
Fixes repository file hash generator, which now only includes .zip and .msi files, which otherwise turned into invalid hashes because of the repository index file always changing based on the assigned hash, resulting in a different repository hash
Fix: Repository Manager is not using Icinga Web-Requests
Fixes the repository manager by now using Icinga WebRequests instead of Windows WebRequests, allowing the usage of the internal proxy feature.
Fix: Removes String.Builder output while creating new components
Fixes String.Builder object output, while creating new components by using `New-IcingaForWindowsComponent`
Fix: ThresholdInterval data type in plugin docs
Fixes `-ThresholdInterval` data type inside auto generated docs for plugins, which was of type `Object`, but should be of type `String`
Feature: Adds function to create plugin documentation
Adds new function `Publish-IcingaPluginDocumentation` which was previously only available within the plugins package.
Feature: Adds developer tools for easier start and management
Adds additional Cmdlets to get working on new Icinga for Windows components and publishing of modules including validation alot easier.
`New-IcingaForWindowsComponent`: Creates an entire new module structure depending on input values, to get a base skeleton for further development ready
`Publish-IcingaForWindowsComponent`: Properly adds documentation, possible plugin configuration and dependencies of files to the manifest file, ensuring the integrity of the module
`Test-IcingaForWindowsComponent`: Allows to test your module and checks for code styling issues and errors as well as testing the module itself, if it can be imported, printing errors in case of problems
`Open-IcingaForWindowsComponentInEditor`: Allows to open a certain Icinga for Windows component in an editor to get started a lot easier. Only supports `Visual Studio Code` at the moment
Feature: Adds generic EventLog reader and IfW reader
Adds generic reader function `Read-IcingaWindowsEventLog`, allowing to read any EventLog as stream on the console and adds in addition `Read-IcingaForWindowsLog` for reading Icinga for Windows specific logs
Feature: Adds support to read EventLog for logs
Starting with Icinga 2.13.0, the Agent will write to the Windows EventLog by default. Our `Read-IcingaAgentLogFile` Cmdlet will now support both and read from the EventLog if the feature is enabled and 2.13.0 or later is being installed
Fix: Thershold interval time conversion
Fixes an issue with `-ThresholdInterval` unit conversion, which causes an error if you want to convert `60m` or `1h`, as the used object is returning 0 for minutes in this matter, as the object itself moved to hours instead.
We should use `TotalMinutes` instead of `Minutes` on our `TimeSpan` object and round every single value returned to 0 digits.
Fix: Use alias for args name on config generation
In case we are using aliases for command arguments/parameters, we should always use the first alias we find as argument instead of using the real name.