Fixes JEA service errors not resetting themself

This commit is contained in:
Lord Hepipud 2022-01-29 00:23:58 +01:00
parent 694c31c7fc
commit 051ac452b3
2 changed files with 11 additions and 1 deletions

View file

@ -36,6 +36,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#451](https://github.com/Icinga/icinga-powershell-framework/pull/451) Fixes PowerShell being unable to enter JEA context if only the Framework is installed and removes the `|` from plugin output, in case a JEA error is thrown that check commands are not present * [#451](https://github.com/Icinga/icinga-powershell-framework/pull/451) Fixes PowerShell being unable to enter JEA context if only the Framework is installed and removes the `|` from plugin output, in case a JEA error is thrown that check commands are not present
* [#452](https://github.com/Icinga/icinga-powershell-framework/pull/452) Fixes unhandled `true` output on the console while running the installer * [#452](https://github.com/Icinga/icinga-powershell-framework/pull/452) Fixes unhandled `true` output on the console while running the installer
* [#454](https://github.com/Icinga/icinga-powershell-framework/pull/454) Fixes JEA catalog compiler and background daemon execution in JEA context * [#454](https://github.com/Icinga/icinga-powershell-framework/pull/454) Fixes JEA catalog compiler and background daemon execution in JEA context
* [#456](https://github.com/Icinga/icinga-powershell-framework/pull/456) Fixes JEA service error count not resetting itself after a certain amount of time without errors
### Enhancements ### Enhancements

View file

@ -73,6 +73,7 @@ function Start-IcingaForWindowsDaemon()
if ($RunAsService) { if ($RunAsService) {
[int]$JeaRestartCounter = 1; [int]$JeaRestartCounter = 1;
$FailureTime = $null;
while ($TRUE) { while ($TRUE) {
if ([string]::IsNullOrEmpty($JeaProfile) -eq $FALSE) { if ([string]::IsNullOrEmpty($JeaProfile) -eq $FALSE) {
if ([string]::IsNullOrEmpty($JeaPid)) { if ([string]::IsNullOrEmpty($JeaPid)) {
@ -86,14 +87,22 @@ function Start-IcingaForWindowsDaemon()
} }
Write-IcingaFileSecure -File $JeaPidFile -Value ''; Write-IcingaFileSecure -File $JeaPidFile -Value '';
$FailureTime = [DateTime]::Now;
Write-IcingaEventMessage -EventId 1505 -Namespace Framework -Objects ([string]::Format('{0}/5', $JeaRestartCounter)); Write-IcingaEventMessage -EventId 1505 -Namespace Framework -Objects ([string]::Format('{0}/5', $JeaRestartCounter));
Start-IcingaForWindowsDaemon -RunAsService:$RunAsService -JEAContext:$JEAContext -JEARestart; Start-IcingaForWindowsDaemon -RunAsService:$RunAsService -JEAContext:$JEAContext -JEARestart;
if (([DateTime]::Now - $FailureTime).TotalSeconds -lt 180) {
$JeaRestartCounter += 1; $JeaRestartCounter += 1;
} else {
$JeaRestartCounter = 1;
}
$JeaPid = ''; $JeaPid = '';
} }
Start-Sleep -Seconds 5; Start-Sleep -Seconds 5;
$JeaAliveCounter += 1;
continue; continue;
} }
Start-Sleep -Seconds 100; Start-Sleep -Seconds 100;