Fix perfdata value output on variable overflow

This commit is contained in:
Lord Hepipud 2020-08-20 10:06:50 +02:00
parent 564711c1b6
commit 044ba4bf03
3 changed files with 3 additions and 3 deletions

View file

@ -50,7 +50,7 @@ Check Command configuration generated by Icinga for Windows 1.2.0 require Icinga
* [#91](https://github.com/Icinga/icinga-powershell-framework/issues/91) Fix wrong default values being set for installer arguments by using the Icinga Director Self-Service API
* [#92](https://github.com/Icinga/icinga-powershell-framework/issues/92) Fix `Set-IcingaAcl` which fails on older Windows systems with a security id error and not at all/not properly setting required permissions for directories
* [#96](https://github.com/Icinga/icinga-powershell-framework/issues/96) Re-Implements caching for Performance Counters and fixes an issue with counters sometimes returning value 0 instead of the correct value
* [#97](https://github.com/Icinga/icinga-powershell-framework/issues/97) Fix value digit count for Performance Counters
* [#97](https://github.com/Icinga/icinga-powershell-framework/issues/97), [#101](https://github.com/Icinga/icinga-powershell-framework/issues/101), [#104](https://github.com/Icinga/icinga-powershell-framework/issues/104) Fix value digit count for Performance Counters
## 1.1.2 (2020-07-01)

View file

@ -76,7 +76,7 @@ function New-IcingaPerformanceCounterObject()
try {
[string]$CounterType = $this.PerfCounter.CounterType;
$CounterData.Add('value', ([math]::Round($this.PerfCounter.NextValue(), 6)));
$CounterData.Add('value', ([math]::Round([decimal]$this.PerfCounter.NextValue(), 6)));
$CounterData.Add('sample', $this.PerfCounter.NextSample());
$CounterData.Add('help', $this.PerfCounter.CounterHelp);
$CounterData.Add('type', $CounterType);

View file

@ -10,5 +10,5 @@ function Format-IcingaPerfDataValue()
# Convert our value to a string and replace ',' with a '.' to allow Icinga to parse the output
# In addition, round every output to 6 digits
return (([string]([math]::round($PerfValue, 6))).Replace(',', '.'));
return (([string]([math]::round([decimal]$PerfValue, 6))).Replace(',', '.'));
}