mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Merge pull request #456 from Icinga:fix/jea_service_error_does_not_reset
Fix: JEA service error count not resetting itself While running the Icinga for Windows service in JEA context, it can happen that the corresponding WinRM service is restarted or terminated. The service daemon will keep an eye on that and restart the JEA session up to 5 times, before terminating the service and printing an error. This fix will not add a grace period, which will reset the failure counter in case the service was running for more than 3 minutes. Which is more then enough runtime to not asume a faulty service behavior.
This commit is contained in:
commit
d8e87b9272
2 changed files with 11 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
$JeaRestartCounter += 1;
|
if (([DateTime]::Now - $FailureTime).TotalSeconds -lt 180) {
|
||||||
|
$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;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue