Merge pull request #104 from Icinga:fix/perfdata_values_output

Fix perf data output on variable overflow

This will resolve the issue on performance data being printed like "6.3E-05" and causing wrong metrics and errors within the log files
This commit is contained in:
Lord Hepipud 2020-08-21 11:16:14 +02:00 committed by GitHub
commit 2e2cc3e604
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -51,7 +51,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 * [#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 * [#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 * [#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) ## 1.1.2 (2020-07-01)

View file

@ -112,7 +112,7 @@ function New-IcingaPerformanceCounterObject()
try { try {
[string]$CounterType = $this.PerfCounter.CounterType; [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('sample', $this.PerfCounter.NextSample());
$CounterData.Add('help', $this.PerfCounter.CounterHelp); $CounterData.Add('help', $this.PerfCounter.CounterHelp);
$CounterData.Add('type', $CounterType); $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 # 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 # In addition, round every output to 6 digits
return (([string]([math]::round($PerfValue, 6))).Replace(',', '.')); return (([string]([math]::round([decimal]$PerfValue, 6))).Replace(',', '.'));
} }