diff --git a/lib/core/framework/Get-IcingaCheckSchedulerPerfData.psm1 b/lib/core/framework/Get-IcingaCheckSchedulerPerfData.psm1 new file mode 100644 index 0000000..8b750fa --- /dev/null +++ b/lib/core/framework/Get-IcingaCheckSchedulerPerfData.psm1 @@ -0,0 +1,23 @@ +function Get-IcingaCheckSchedulerPerfData() +{ + if ($null -eq $IcingaDaemonData) { + return $null; + } + + if ($IcingaDaemonData.ContainsKey('IcingaThreadContent') -eq $FALSE) { + return $null; + } + + if ($IcingaDaemonData.IcingaThreadContent.ContainsKey('Scheduler') -eq $FALSE) { + return $null; + } + + if ($IcingaDaemonData.IcingaThreadContent.Scheduler.ContainsKey('PluginPerfData') -eq $FALSE) { + return $null; + } + + $PerfData = $IcingaDaemonData.IcingaThreadContent.Scheduler.PluginPerfData; + $IcingaDaemonData.IcingaThreadContent.Scheduler.PluginPerfData = @(); + + return $PerfData; +} diff --git a/lib/core/framework/Get-IcingaCheckSchedulerPluginOutput.psm1 b/lib/core/framework/Get-IcingaCheckSchedulerPluginOutput.psm1 new file mode 100644 index 0000000..6f2ad89 --- /dev/null +++ b/lib/core/framework/Get-IcingaCheckSchedulerPluginOutput.psm1 @@ -0,0 +1,23 @@ +function Get-IcingaCheckSchedulerPluginOutput() +{ + if ($null -eq $IcingaDaemonData) { + return $null; + } + + if ($IcingaDaemonData.ContainsKey('IcingaThreadContent') -eq $FALSE) { + return $null; + } + + if ($IcingaDaemonData.IcingaThreadContent.ContainsKey('Scheduler') -eq $FALSE) { + return $null; + } + + if ($IcingaDaemonData.IcingaThreadContent.Scheduler.ContainsKey('PluginCache') -eq $FALSE) { + return $null; + } + + $CheckResult = [string]::Join("`r`n", $IcingaDaemonData.IcingaThreadContent.Scheduler.PluginCache); + $IcingaDaemonData.IcingaThreadContent.Scheduler.PluginCache = @(); + + return $CheckResult; +} diff --git a/lib/core/framework/New-IcingaCheckSchedulerEnvironment.psm1 b/lib/core/framework/New-IcingaCheckSchedulerEnvironment.psm1 new file mode 100644 index 0000000..bc737ec --- /dev/null +++ b/lib/core/framework/New-IcingaCheckSchedulerEnvironment.psm1 @@ -0,0 +1,8 @@ +function New-IcingaCheckSchedulerEnvironment() +{ + $IcingaDaemonData.IcingaThreadContent.Add('Scheduler', @{ }); + if ($IcingaDaemonData.IcingaThreadContent['Scheduler'].ContainsKey('PluginCache') -eq $FALSE) { + $IcingaDaemonData.IcingaThreadContent['Scheduler'].Add('PluginCache', @()); + $IcingaDaemonData.IcingaThreadContent['Scheduler'].Add('PluginPerfData', @()); + } +}