Skip to content

Commit 10c7bd5

Browse files
authored
Merge pull request #800 from Icinga:fix/fixes_metrics_over_time_unknown_for_noperfdata_checks
Fix MetricsOverTime reporting unknown for checks which do not write performance data Fixes an issue for certain plugins, like `Invoke-IcingaCheckProcess`, which reports unknown if MetricsOverTime is used for checks that do not write performance data
2 parents 94c4288 + f75f873 commit 10c7bd5

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

doc/100-General/10-Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
1515

1616
* [#787](https://github.com/Icinga/icinga-powershell-framework/pull/787) Fixes the return value in case the `Agent` component could not be installed from `$FALSE` to `null`
1717

18+
## 1.13.3 (tbd)
19+
20+
* [#800](https://github.com/Icinga/icinga-powershell-framework/pull/800) Fixes an issue for certain plugins, like `Invoke-IcingaCheckProcess`, which reports unknown if MetricsOverTime is used for checks that do not write performance data
21+
1822
## 1.13.2 (2025-02-03)
1923

2024
[Issues and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/40)

lib/icinga/plugin/Compare-IcingaPluginThresholds.psm1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ function Compare-IcingaPluginThresholds()
9797
[switch]$IsBetween = $FALSE,
9898
[switch]$IsLowerEqual = $FALSE,
9999
[switch]$IsGreaterEqual = $FALSE,
100-
[string]$TimeInterval = $null
100+
[string]$TimeInterval = $null,
101+
[switch]$NoPerfData = $FALSE
101102
);
102103

103104
try {
@@ -109,6 +110,13 @@ function Compare-IcingaPluginThresholds()
109110
'Interval' = $TimeInterval;
110111
};
111112

113+
# Ensure we do not include our checks for which we do not write any performance data
114+
# Metrics over time will not work for those, as the metrics are not stored.
115+
# There just set the variable to null which means they won't be processed
116+
if ($NoPerfData) {
117+
$MoTData = $null;
118+
}
119+
112120
if ($TestInput.Decimal) {
113121
[decimal]$InputValue = [decimal]$TestInput.Value;
114122
}

lib/icinga/plugin/New-IcingaCheck.psm1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function New-IcingaCheck()
3939
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'ObjectExists' -Value $ObjectExists;
4040
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'Translation' -Value $Translation;
4141
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'LabelName' -Value $LabelName;
42-
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'NoPerfData' -Value $NoPerfData;
42+
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'NoPerfData' -Value ([bool]$NoPerfData);
4343
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__WarningValue' -Value $null;
4444
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__CriticalValue' -Value $null;
4545
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__LockedState' -Value $FALSE;
@@ -490,6 +490,7 @@ function New-IcingaCheck()
490490
'-ThresholdCache' = (Get-IcingaThresholdCache -CheckCommand $this.__CheckCommand);
491491
'-Translation' = $this.Translation;
492492
'-TimeInterval' = $this.__TimeInterval;
493+
'-NoPerfData' = $this.NoPerfData;
493494
};
494495
}
495496

0 commit comments

Comments
 (0)