2019-09-28 15:45:59 -04:00
|
|
|
function Write-IcingaPluginPerfData()
|
|
|
|
|
{
|
2025-01-29 08:45:53 -05:00
|
|
|
# We shouldn't write all Metrics over Time to Icinga, as this will just cause a massive
|
|
|
|
|
# overload of Performance Metrics written and processed. We leave this code for now
|
|
|
|
|
# allowing us to enable it later again or make it user configurable
|
|
|
|
|
#[string]$MetricsOverTime = Get-IcingaMetricsOverTimePerfData -AddWhiteSpace;
|
|
|
|
|
[string]$MetricsOverTime = '';
|
|
|
|
|
|
2021-12-09 11:42:06 -05:00
|
|
|
if ($Global:Icinga.Protected.RunAsDaemon -eq $FALSE -And $Global:Icinga.Protected.JEAContext -eq $FALSE) {
|
2024-08-19 10:13:24 -04:00
|
|
|
if ($Global:Icinga.Private.Scheduler.PerfDataWriter.Storage.Length -ne 0) {
|
2025-01-29 08:45:53 -05:00
|
|
|
Write-IcingaConsolePlain ([string]::Format('| {0}{1}', ($Global:Icinga.Private.Scheduler.PerfDataWriter.Storage.ToString()), $MetricsOverTime));
|
2022-05-24 10:44:52 -04:00
|
|
|
}
|
2024-08-19 10:13:24 -04:00
|
|
|
} else {
|
2025-01-29 08:45:53 -05:00
|
|
|
$Global:Icinga.Private.Scheduler.PerformanceData = $Global:Icinga.Private.Scheduler.PerfDataWriter.Storage.ToString() + $MetricsOverTime;
|
2019-09-28 15:45:59 -04:00
|
|
|
}
|
|
|
|
|
|
2024-08-19 10:13:24 -04:00
|
|
|
# Ensure we clear our cache after writing the data
|
|
|
|
|
$Global:Icinga.Private.Scheduler.PerfDataWriter.Cache.Clear() | Out-Null;
|
|
|
|
|
$Global:Icinga.Private.Scheduler.PerfDataWriter.Storage.Clear() | Out-Null;
|
2019-09-28 15:45:59 -04:00
|
|
|
}
|