mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes custom daemon example for restart_error counter
This commit is contained in:
parent
cac7e941f0
commit
10c9add973
1 changed files with 14 additions and 2 deletions
|
|
@ -296,7 +296,13 @@ function Start-IcingaAgentServiceTest()
|
|||
if ($ServiceState.Status -ne 'Running') {
|
||||
try {
|
||||
# Try to restart the service
|
||||
Restart-Service 'icinga2';
|
||||
Restart-Service 'icinga2' -ErrorAction Stop;
|
||||
|
||||
Add-IcingaHashtableItem `
|
||||
-Hashtable $IcingaDaemonData.BackgroundDaemon.TestIcingaAgentService.ServiceState `
|
||||
-Key 'restart_error' `
|
||||
-Value 0 `
|
||||
-Override | Out-Null;
|
||||
} catch {
|
||||
# Add an error counter in case we failed
|
||||
$RestartErrors += 1;
|
||||
|
|
@ -378,7 +384,13 @@ function Start-IcingaAgentServiceTest()
|
|||
if ($ServiceState.Status -ne 'Running') {
|
||||
try {
|
||||
# Try to restart the service
|
||||
Restart-Service 'icinga2';
|
||||
Restart-Service 'icinga2' -ErrorAction Stop;
|
||||
|
||||
Add-IcingaHashtableItem `
|
||||
-Hashtable $IcingaDaemonData.BackgroundDaemon.TestIcingaAgentService.ServiceState `
|
||||
-Key 'restart_error' `
|
||||
-Value 0 `
|
||||
-Override | Out-Null;
|
||||
} catch {
|
||||
# Add an error counter in case we failed
|
||||
$RestartErrors += 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue