lrk
1
Hello everyone,
It looks like the data units are no longer being converted correctly, or I’m missing something. 
New-IcingaCheck -Name "Total Size" -Value $TotalSize -Unit "mb" -MetricIndex "total" -MetricName "dbsize"
if $TotalSize is less than 999, “999B” is output instead of “999MB”.
if greater than 999 (e.g. 1000), 1 GB is output correctly.
This also has an impact on performance data that is written, as it is now much too small.
Hope you can help me or this topic can improve the PowerShell framework!
cstein
(Lord Hepipud)
2
Hello,
thanks for the comment. You are right, there seems to be something odd with v1.13.x
How it was in v1.12.x
$TotalSize = 1000;
New-IcingaCheckResult -Compile -Check (New-IcingaCheck -Name "Total Size" -Value $TotalSize -Unit "mb" -MetricIndex "total" -MetricName "dbsize");
[OK] Total Size: 1GB
| 'total::ifw_::dbsize'=1000000000B;;
$TotalSize = 999;
icinga> New-IcingaCheckResult -Compile -Check (New-IcingaCheck -Name "Total Size" -Value $TotalSize -Unit "mb" -MetricIndex "total" -MetricName "dbsize");
[OK] Total Size: 999MB
| 'total::ifw_::dbsize'=999000000B;;
How it is with v1.13.x
$TotalSize = 1000;
New-IcingaCheckResult -Compile -Check (New-IcingaCheck -Name "Total Size" -Value $TotalSize -Unit "mb" -MetricIndex "total" -MetricName "dbsize");
[OK] Total Size: 1GB
| total::ifw_::dbsize=1000;;;;
$TotalSize = 999;
New-IcingaCheckResult -Compile -Check (New-IcingaCheck -Name "Total Size" -Value $TotalSize -Unit "mb" -MetricIndex "total" -MetricName "dbsize");
[OK] Total Size: 999B
| total::ifw_::dbsize=999;;;;
Looks to me like something is odd with detecting the value and properly parsing the unit provided in the check.
Based on my testing so far this only seems to affect checks using anything else than Bytes as values
lrk
3
Thank you @cstein for taking a look at this.
And in general for the powershell framework, it’s really fun to work with.
Will this be fixed in 1.13?
I think this is critical if the performance data is written incorrectly.