Adds support for simple setup and fetching of internal check scheduler data

This commit is contained in:
Christian Stein 2020-03-25 22:03:31 +01:00
parent 483356136c
commit eb948d8d22
3 changed files with 54 additions and 0 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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', @());
}
}