mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Fixes service daemon not working with arguments
This commit is contained in:
parent
8a3d5f6430
commit
9f423d060f
3 changed files with 24 additions and 6 deletions
|
|
@ -22,6 +22,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
* [#284](https://github.com/Icinga/icinga-powershell-framework/issues/284) Fixes exception while creating default threshold objects
|
||||
* [#285](https://github.com/Icinga/icinga-powershell-framework/issues/285) Fixes plain Icinga 2 conf generation for commands, which was caused by a new exception output for additional output
|
||||
* [#293](https://github.com/Icinga/icinga-powershell-framework/pull/293) Fixes crash on REST-Api for NULL values while parsing the REST message
|
||||
* [#295](https://github.com/Icinga/icinga-powershell-framework/issues/295) Fixes background service check daemon not working with arguments for plugins
|
||||
|
||||
## 1.5.0 (2021-06-02)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,19 @@ function Start-IcingaServiceCheckDaemon()
|
|||
continue;
|
||||
}
|
||||
|
||||
Start-IcingaServiceCheckTask -CheckId $service -CheckCommand $RegisteredServices[$service].CheckCommand -Arguments $RegisteredServices[$service].Arguments -Interval $RegisteredServices[$service].Interval -TimeIndexes $RegisteredServices[$service].TimeIndexes;
|
||||
[hashtable]$ServiceArgs = @{ };
|
||||
|
||||
if ($null -ne $RegisteredServices[$service].Arguments) {
|
||||
foreach ($property in $RegisteredServices[$service].Arguments.PSObject.Properties) {
|
||||
if ($ServiceArgs.ContainsKey($property.Name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ServiceArgs.Add($property.Name, $property.Value)
|
||||
}
|
||||
}
|
||||
|
||||
Start-IcingaServiceCheckTask -CheckId $service -CheckCommand $RegisteredServices[$service].CheckCommand -Arguments $ServiceArgs -Interval $RegisteredServices[$service].Interval -TimeIndexes $RegisteredServices[$service].TimeIndexes;
|
||||
}
|
||||
Start-Sleep -Seconds 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ function New-IcingaCheckBaseObject()
|
|||
}
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrEmpty($this.__CheckCommand)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($null -eq $Global:Icinga) {
|
||||
$Global:Icinga = @{ };
|
||||
}
|
||||
|
|
@ -33,14 +37,15 @@ function New-IcingaCheckBaseObject()
|
|||
$Global:Icinga.Add('ThresholdCache', @{ });
|
||||
}
|
||||
|
||||
if ($Global:Icinga.ThresholdCache.ContainsKey($this.__CheckCommand)) {
|
||||
if ($Global:Icinga.ThresholdCache.ContainsKey($this.__CheckCommand) -eq $FALSE) {
|
||||
$Global:Icinga.ThresholdCache.Add($this.__CheckCommand, $null);
|
||||
}
|
||||
|
||||
if ($null -ne $Global:Icinga.ThresholdCache[$this.__CheckCommand]) {
|
||||
return;
|
||||
}
|
||||
|
||||
$Global:Icinga.ThresholdCache.Add(
|
||||
$this.__CheckCommand,
|
||||
(Get-IcingaCacheData -Space 'sc_daemon' -CacheStore 'checkresult' -KeyName $this.__CheckCommand)
|
||||
);
|
||||
$Global:Icinga.ThresholdCache[$this.__CheckCommand] = (Get-IcingaCacheData -Space 'sc_daemon' -CacheStore 'checkresult' -KeyName $this.__CheckCommand);
|
||||
}
|
||||
|
||||
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__SetParent' -Value {
|
||||
|
|
|
|||
Loading…
Reference in a new issue