Skip to content

Commit 876791d

Browse files
committed
Fixes exception on service check on null-pointer
1 parent a4c47b5 commit 876791d

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
@@ -22,6 +22,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
2222
### Bugfixes
2323

2424
* [#123](https://github.com/Icinga/icinga-powershell-plugins/pull/123) Fixes wrong documented user group for accessing Performance Counter objects which should be `Performance Monitor Users`
25+
* [#124](https://github.com/Icinga/icinga-powershell-plugins/pull/124) Fixes crash on `Invoke-IcingaCheckService` if an automatic service is not running
2526

2627
## 1.3.0 (2020-12-01)
2728

plugins/Invoke-IcingaCheckService.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function Invoke-IcingaCheckService()
9999
continue;
100100
}
101101

102-
# Service is not running bug the ExitCode is 0 -> this is fine and should not raise a critical
102+
# Service is not running but the ExitCode is 0 -> this is fine and should not raise a critical
103103
if ($autoservice.configuration.ExitCode -eq 0) {
104104
$ServicesPackage.AddCheck(
105105
(New-IcingaWindowsServiceCheckObject -Status 'Stopped' -Service $autoservice -NoPerfData)
@@ -109,7 +109,7 @@ function Invoke-IcingaCheckService()
109109

110110
# Services which should be running, but are not
111111
$ServicesPackage.AddCheck(
112-
(New-IcingaWindowsServiceCheckObject -Status 'Running' -Service $FetchedServices[$services] -NoPerfData)
112+
(New-IcingaWindowsServiceCheckObject -Status 'Running' -Service $autoservice -NoPerfData)
113113
);
114114
}
115115
} else {

0 commit comments

Comments
 (0)