mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Adds support for simple setup and fetching of internal check scheduler data
This commit is contained in:
parent
483356136c
commit
eb948d8d22
3 changed files with 54 additions and 0 deletions
23
lib/core/framework/Get-IcingaCheckSchedulerPerfData.psm1
Normal file
23
lib/core/framework/Get-IcingaCheckSchedulerPerfData.psm1
Normal 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;
|
||||
}
|
||||
23
lib/core/framework/Get-IcingaCheckSchedulerPluginOutput.psm1
Normal file
23
lib/core/framework/Get-IcingaCheckSchedulerPluginOutput.psm1
Normal 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;
|
||||
}
|
||||
|
|
@ -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', @());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue