mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Merge pull request #296 from Icinga:fix/service_daemon_check_args
Fix: Service check background daemon not working with arguments
This commit is contained in:
commit
1c540e55e3
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
|
* [#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
|
* [#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
|
* [#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)
|
## 1.5.0 (2021-06-02)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,19 @@ function Start-IcingaServiceCheckDaemon()
|
||||||
continue;
|
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;
|
Start-Sleep -Seconds 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,10 @@ function New-IcingaCheckBaseObject()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($this.__CheckCommand)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($null -eq $Global:Icinga) {
|
if ($null -eq $Global:Icinga) {
|
||||||
$Global:Icinga = @{ };
|
$Global:Icinga = @{ };
|
||||||
}
|
}
|
||||||
|
|
@ -33,14 +37,15 @@ function New-IcingaCheckBaseObject()
|
||||||
$Global:Icinga.Add('ThresholdCache', @{ });
|
$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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$Global:Icinga.ThresholdCache.Add(
|
$Global:Icinga.ThresholdCache[$this.__CheckCommand] = (Get-IcingaCacheData -Space 'sc_daemon' -CacheStore 'checkresult' -KeyName $this.__CheckCommand);
|
||||||
$this.__CheckCommand,
|
|
||||||
(Get-IcingaCacheData -Space 'sc_daemon' -CacheStore 'checkresult' -KeyName $this.__CheckCommand)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__SetParent' -Value {
|
$IcingaCheckBaseObject | Add-Member -MemberType ScriptMethod -Name '__SetParent' -Value {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue