Fixes thershold interval time conversion

This commit is contained in:
Lord Hepipud 2021-11-03 17:19:16 +01:00
parent 6e9f256d98
commit bfd0237256
2 changed files with 3 additions and 2 deletions

View file

@ -19,6 +19,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#381](https://github.com/Icinga/icinga-powershell-framework/issues/381) Fixes Repository Hash generator for new repositories, which always returned the same hash regardless of the files inside
* [#386](https://github.com/Icinga/icinga-powershell-framework/pull/386) Fixes check command config generator for Icinga Director baskets/Icinga 2 conf files, in case we are using a check command with an alias as reference to a new name of a check command
* [#387](https://github.com/Icinga/icinga-powershell-framework/pull/387) Fixes config generator to use alias names for command arguments/parameters in case available instead of the real name
* [#390](https://github.com/Icinga/icinga-powershell-framework/pull/390) Fixes threshold interval time conversion by using `-ThresholdInterval` with values that cause the used `TimeSpan` object to move from minutes to hours, like `60m` and `1h`
### Enhancements

View file

@ -61,7 +61,7 @@ function Compare-IcingaPluginThresholds()
if ([string]::IsNullOrEmpty($TimeInterval) -eq $FALSE -And $null -ne $ThresholdCache) {
$TimeSeconds = ConvertTo-Seconds $TimeInterval;
$MinuteInterval = ([TimeSpan]::FromSeconds($TimeSeconds)).Minutes;
$MinuteInterval = [math]::round(([TimeSpan]::FromSeconds($TimeSeconds)).TotalMinutes, 0);
$CheckPerfDataLabel = [string]::Format('{0}_{1}', (Format-IcingaPerfDataLabel $CheckName), $MinuteInterval);
if ($null -ne $ThresholdCache.$CheckPerfDataLabel) {
@ -96,7 +96,7 @@ function Compare-IcingaPluginThresholds()
$Threshold = $TmpValue.Substring(0, $LastIndex);
$TimeIndex = $TmpValue.Substring($LastIndex + 1, $TmpValue.Length - $LastIndex - 1);
$TimeSeconds = ConvertTo-Seconds $TimeIndex;
$MinuteInterval = ([TimeSpan]::FromSeconds($TimeSeconds)).Minutes;
$MinuteInterval = [math]::round(([TimeSpan]::FromSeconds($TimeSeconds)).TotalMinutes, 0);
$CheckPerfDataLabel = [string]::Format('{0}_{1}', (Format-IcingaPerfDataLabel $CheckName), $MinuteInterval);