Open ledvinap opened 1 year ago
Can also be tested/reproduced quite easily in the console:
Icinga 2 (version: v2.12.9)
Type $help to view available commands.
<1> => parse_performance_data("test=42c").counter
true
Icinga 2 (version: v2.13.5)
Type $help to view available commands.
<1> => parse_performance_data("test=42c").counter
false
Describe the bug
Parsing code does ignore perfdata value with counter type (
c
suffix)DupUoMs maps
c
tounit = "", base = 1
(https://github.com/Icinga/icinga2/blob/master/lib/base/perfdatavalue.cpp#L33, https://github.com/Icinga/icinga2/blob/master/lib/base/perfdatavalue.cpp#L33). Then code tests forunit == "c"
- butunit
is already empty string (https://github.com/Icinga/icinga2/blob/master/lib/base/perfdatavalue.cpp#L294-L296)Code before UOM change did work (https://github.com/Icinga/icinga2/commit/720a88c29a489cec91815af49755413202802d7a#diff-93211109a65aef5eddad6a78b4e380d7f08626422b7bc69e37720f37bbab62a5L93-L95)
Expected behavior
counter
argument toPerfdataValue
constructor is set forunit == "c"
Your Environment
master branch, since 3 Apr 2020
Fix is trivial, just move
if (unit == "c") {
before unit mapping