Fixes performance data output for single checks

This commit is contained in:
Lord Hepipud 2019-11-05 12:39:54 +01:00
parent 6cb7bd4414
commit 06b7c0cdd5
2 changed files with 9 additions and 1 deletions

View file

@ -24,7 +24,7 @@ function New-IcingaCheckresult()
$this.check.Compile($TRUE) | Out-Null;
if ([int]$this.check.exitcode -ne [int]$IcingaEnums.IcingaExitCode.Unknown -And -Not $this.noperfdata) {
Write-IcingaPluginPerfData -PerformanceData ($this.check.GetPerfData().perfdata) -CheckCommand $CheckCommand;
Write-IcingaPluginPerfData -PerformanceData ($this.check.GetPerfData()) -CheckCommand $CheckCommand;
}
return $this.check.exitcode;

View file

@ -5,6 +5,14 @@ function Write-IcingaPluginPerfData()
$CheckCommand
);
if ($PerformanceData.package -eq $FALSE) {
$PerformanceData = @{
$PerformanceData.label = $PerformanceData;
}
} else {
$PerformanceData = $PerformanceData.perfdata;
}
$CheckResultCache = Get-IcingaCacheData -Space 'sc_daemon' -CacheStore 'checkresult' -KeyName $CheckCommand;
if ($global:IcingaDaemonData.FrameworkRunningAsDaemon -eq $FALSE) {