Skip to content

Commit 1e87a76

Browse files
authored
Merge pull request #110 from Icinga:fix/eventlog_throws_unknown_for_invalid_arguments
Fix: Eventlog throwing unknown on valid arguments Fixes EventLog plugin throwing an unknown for valid arguments: ```powershell icinga { Invoke-IcingaCheckEventlog '-Warning' '5' '-Critical' '10' '-LogName' 'Application' '-IncludeEventId' '@()' '-ExcludeEventId' '@()' '-IncludeUsername @() -IncludeEntryType @() -ExcludeEntryType @() -IncludeMessage @() -ExcludeMessage @() -IncludeSource @() -ExcludeSource @() } ``` ```text [UNKNOWN]: Icinga Invalid Input Error was thrown: EventLog Failed to fetch EventLog information. Please check your inputs for EntryTypes and other categories and try again. ```
2 parents 9ae3bfa + 9bbd32d commit 1e87a76

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

doc/31-Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ If you are going to install this plugin release, please have a look on the [upgr
4242
* [#86](https://github.com/Icinga/icinga-powershell-plugins/pull/86) Fixes `Get-IcingaCPUCount` returns wrong count on empty arguments
4343
* [#97](https://github.com/Icinga/icinga-powershell-plugins/issues/97), [#98](https://github.com/Icinga/icinga-powershell-plugins/pull/98) Fixes invalid performance data output for `Invoke-IcingaCheckScheduledTask`
4444
* [#102](https://github.com/Icinga/icinga-powershell-plugins/pull/102), [#103](https://github.com/Icinga/icinga-powershell-plugins/pull/103) Fixes `Invoke-IcingaCheckNetworkInterface` plugins arguments being too long for Icinga Director
45+
* [#110](https://github.com/Icinga/icinga-powershell-plugins/pull/110) Fixes `Invoke-IcingaCheckEventLog` plugin throwing an unknown for valid arguments
4546

4647
## 1.2.0 (2020-08-28)
4748

provider/eventlog/Get-IcingaEventLog.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ function Get-IcingaEventLog()
4444
$After = [datetime]::Now.Subtract([TimeSpan]::FromHours(2));
4545
}
4646

47-
if ($null -ne $IncludeUsername) {
47+
if ($null -ne $IncludeUsername -And $IncludeUsername.Count -ne 0) {
4848
$EventLogArguments.Add('UserName', $IncludeUsername);
4949
}
50-
if ($null -ne $IncludeEntryType) {
50+
if ($null -ne $IncludeEntryType -And $IncludeEntryType.Count -ne 0) {
5151
$EventLogArguments.Add('EntryType', $IncludeEntryType);
5252
}
5353
if ($null -ne $After) {

0 commit comments

Comments
 (0)