Skip to content

Fix MetricsOverTime reporting unknown for checks which do not write performance data #800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/100-General/10-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic

* [#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`

## 1.13.3 (tbd)

* [#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

## 1.13.2 (2025-02-03)

[Issues and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/40)
Expand Down
10 changes: 9 additions & 1 deletion lib/icinga/plugin/Compare-IcingaPluginThresholds.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ function Compare-IcingaPluginThresholds()
[switch]$IsBetween = $FALSE,
[switch]$IsLowerEqual = $FALSE,
[switch]$IsGreaterEqual = $FALSE,
[string]$TimeInterval = $null
[string]$TimeInterval = $null,
[switch]$NoPerfData = $FALSE
);

try {
Expand All @@ -109,6 +110,13 @@ function Compare-IcingaPluginThresholds()
'Interval' = $TimeInterval;
};

# Ensure we do not include our checks for which we do not write any performance data
# Metrics over time will not work for those, as the metrics are not stored.
# There just set the variable to null which means they won't be processed
if ($NoPerfData) {
$MoTData = $null;
}

if ($TestInput.Decimal) {
[decimal]$InputValue = [decimal]$TestInput.Value;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/icinga/plugin/New-IcingaCheck.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function New-IcingaCheck()
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'ObjectExists' -Value $ObjectExists;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'Translation' -Value $Translation;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'LabelName' -Value $LabelName;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'NoPerfData' -Value $NoPerfData;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name 'NoPerfData' -Value ([bool]$NoPerfData);
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__WarningValue' -Value $null;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__CriticalValue' -Value $null;
$IcingaCheck | Add-Member -MemberType NoteProperty -Name '__LockedState' -Value $FALSE;
Expand Down Expand Up @@ -490,6 +490,7 @@ function New-IcingaCheck()
'-ThresholdCache' = (Get-IcingaThresholdCache -CheckCommand $this.__CheckCommand);
'-Translation' = $this.Translation;
'-TimeInterval' = $this.__TimeInterval;
'-NoPerfData' = $this.NoPerfData;
};
}

Expand Down