Adds new start and stop Cmdlets for Icinga

This commit is contained in:
Lord Hepipud 2024-09-19 12:27:06 +02:00
parent f735362282
commit 7aebc65b49
15 changed files with 34 additions and 24 deletions

View file

@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
### Enhancements
* [#756](https://github.com/Icinga/icinga-powershell-framework/pull/756) Adds feature to set process priority for Icinga for Windows to BelowNormal for improved Host performance
* [#757](https://github.com/Icinga/icinga-powershell-framework/pull/757) Adds new Cmdlets `Start-Icinga`, `Stop-Icinga`, `Start-IcingaForWindows` and `Stop-IcingaForWindows` in addition to the existing Cmdlets `Restart-Icinga` and `Restart-IcingaForWindows`
## 1.13.0 Beta-1 (2024-08-30)

View file

@ -46,7 +46,7 @@ function Install-IcingaForWindowsService()
if ($IfWService.Status -eq 'Running') {
Write-IcingaConsoleNotice 'Stopping Icinga PowerShell service';
Stop-IcingaWindowsService;
Stop-IcingaForWindows;
Start-Sleep -Seconds 1;
}
@ -93,7 +93,7 @@ function Install-IcingaForWindowsService()
Set-IcingaServiceUser -User 'LocalSystem' -Service 'icingapowershell' | Out-Null;
Restart-IcingaForWindows;
Start-Sleep -Seconds 1;
Stop-IcingaWindowsService;
Stop-IcingaForWindows;
Start-Sleep -Seconds 1;
if ($IfWService.Status -eq 'Running') {

View file

@ -57,7 +57,7 @@ function Install-IcingaFrameworkUpdate()
if ($ServiceStatus -eq 'Running') {
Write-IcingaConsoleNotice 'Stopping Icinga PowerShell service';
Stop-IcingaWindowsService;
Stop-IcingaForWindows;
Start-Sleep -Seconds 1;
}
if ($AgentStatus -eq 'Running') {

View file

@ -17,7 +17,7 @@ function Invoke-IcingaForWindowsMigration()
Write-IcingaConsoleNotice 'Applying pending migrations required for Icinga for Windows v1.8.0';
if ($ServiceStatus -eq 'Running') {
Stop-IcingaWindowsService;
Stop-IcingaForWindows;
}
$ApiChecks = Get-IcingaPowerShellConfig -Path 'Framework.Experimental.UseApiChecks';
@ -46,7 +46,7 @@ function Invoke-IcingaForWindowsMigration()
$ServiceStatus = (Get-Service 'icingapowershell' -ErrorAction SilentlyContinue).Status;
if ($ServiceStatus -eq 'Running') {
Stop-IcingaWindowsService;
Stop-IcingaForWindows;
}
# Convert the time intervals for the background daemon services from the previous index handling

View file

@ -26,7 +26,7 @@ function Uninstall-IcingaForWindowsService()
$ServiceData = Get-IcingaForWindowsServiceData;
Stop-IcingaWindowsService;
Stop-IcingaForWindows;
Start-Sleep -Seconds 1;
$ServiceCreation = Start-IcingaProcess -Executable 'sc.exe' -Arguments 'delete icingapowershell';

View file

@ -83,7 +83,7 @@ function Show-IcingaForWindowsMenuManageIcingaForWindowsServices()
'DisabledReason' = 'The Icinga for Windows service is either not installed or not running';
'AdminMenu' = $TRUE;
'Action' = @{
'Command' = 'Stop-IcingaWindowsService';
'Command' = 'Stop-IcingaForWindows';
}
},
@{

View file

@ -65,7 +65,7 @@ function Deny-IcingaJEACommand()
'Restart-IcingaForWindows'.ToLower() {
return $TRUE;
};
'Stop-IcingaWindowsService'.ToLower() {
'Stop-IcingaForWindows'.ToLower() {
return $TRUE;
};
'Stop-IcingaService'.ToLower() {

View file

@ -163,7 +163,7 @@ function Install-IcingaComponent()
if ($ServiceStatus -eq 'Running') {
Write-IcingaConsoleNotice 'Stopping Icinga for Windows service';
Stop-IcingaWindowsService;
Stop-IcingaForWindows;
Start-Sleep -Seconds 1;
}
if ($AgentStatus -eq 'Running') {

View file

@ -1,5 +1,5 @@
function Restart-Icinga()
{
Restart-IcingaService -Service 'icinga2';
Restart-IcingaForWindows;
Stop-Icinga;
Start-Icinga;
}

View file

@ -1,16 +1,7 @@
function Restart-IcingaForWindows()
{
[string]$JeaPid = Get-IcingaJEAServicePid;
Stop-IcingaService -Service 'icingapowershell';
if ((Test-IcingaJEAServiceRunning -JeaPid $JeaPid)) {
Stop-IcingaJEAProcess -JeaPid $JeaPid;
}
Restart-IcingaService -Service 'icingapowershell';
# Update the process priority after each restart
Start-IcingaWindowsScheduledTaskProcessPriority;
Stop-IcingaForWindows;
Start-IcingaForWindows;
}
Set-Alias -Name 'Restart-IcingaWindowsService' -Value 'Restart-IcingaForWindows';

View file

@ -0,0 +1,5 @@
function Start-Icinga()
{
Start-IcingaService -Service 'icinga2';
Start-IcingaForWindows;
}

View file

@ -0,0 +1,6 @@
function Start-IcingaForWindows()
{
Start-IcingaService -Service 'icingapowershell';
# Update the process priority after each restart
Start-IcingaWindowsScheduledTaskProcessPriority;
}

View file

@ -0,0 +1,5 @@
function Stop-Icinga()
{
Stop-IcingaService -Service 'icinga2';
Stop-IcingaForWindows;
}

View file

@ -1,4 +1,4 @@
function Stop-IcingaWindowsService()
function Stop-IcingaForWindows()
{
[string]$JeaPid = Get-IcingaJEAServicePid;
@ -8,3 +8,5 @@ function Stop-IcingaWindowsService()
Stop-Process -Id $JeaPid -Force;
}
}
Set-Alias -Name 'Stop-IcingaWindowsService' -Value 'Stop-IcingaForWindows';

View file

@ -12,7 +12,7 @@ function Uninstall-IcingaServiceUser()
Write-IcingaConsoleNotice 'Uninstalling user "{0}"' -Objects $IcingaUser;
Stop-IcingaService 'icinga2';
Stop-IcingaWindowsService;
Stop-IcingaForWindows;
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.ServiceUser' -Value '';