Icinga / icinga-powershell-hyperv

A collection of Hyper-V plugins for the Icinga Powershell Framework
GNU General Public License v2.0
5 stars 0 forks source link

Invoke-IcingaCheckHyperVOverCommitment - Incorrect calculation of the number of cores and CSV storage size #76

Open Aleksey-Maksimov opened 5 days ago

Aleksey-Maksimov commented 5 days ago

Hello.

We have a physical HPE ProLiant DL560 Gen10 server with two Xeon Gold 6148 processors (40 physical and 80 logical cores in total). 2 CSV volumes with a capacity of more than 20TiB are connected to the server The plugin on this server tells us the following:


Invoke-IcingaCheckHyperVOverCommitment -Verbosity 2
[OK] Hyper-V Overcommitment: 3 Ok
\_ [OK] CPUOverCommit
   \_ [OK] CUST01-VM01 Used Cores: 46c
   \_ [OK] CUST01-VM01 Used Percent: 130.0%
\_ [OK] RAMOverCommit
   \_ [OK] CUST01-VM01 Used Bytes: 79GiB
   \_ [OK] CUST01-VM01 Used Percent: 0%
\_ [OK] StorageOverCommit
   \_ [OK] Partition C: Overcommitment
      \_ [OK] C: Used Bytes: 1.06TiB
      \_ [OK] C: Used Percent: 0%
| 
'cores::ifw_hypervovercommitcores::usedcores'=46c;;;0;20 
'cores::ifw_hypervovercommitcores::usedpercent'=130%;;;0;100
'memory::ifw_hypervovercommitmemory::usedbytes'=84825600000B;;;0;549394700000 
'memory::ifw_hypervovercommitmemory::usedpercent'=0%;;;0;100 
'c::ifw_hypervovercommitstorage::usedpercent'=0%;;;0;100 
'c::ifw_hypervovercommitstorage::usedbytes'=1168231000000B;;;0;10995100000000 

The 'cores::ifw_hypervovercommitcores::usedcores' metric (46 cores) is calculated correctly, but there is a problem. This metric has the wrong max value (20 instead of 80). Therefore, we see the percentage value in the 'cores::ifw_hypervovercommitcores::usedpercent' metric as 130%, but this is an incorrect value. The real data is as follows: In total there are 80 cores on the server (100%), 46 cores are used. Therefore, the 'cores::ifw_hypervovercommitcores::usedpercent' metric should be equal to 0%.

There are no questions regarding the metrics 'memory::ifw_hypervovercommitmemory::usedbytes' and 'memory::ifw_hypervovercommitmemory::usedpercent'. Everything here is calculated correctly.

The metric 'c::ifw_hypervovercommitstorage::usedbytes' has 10995100000000 as its value, i.e. 10TiB But in reality this is not true. The server has 2 CSV disk volumes with a capacity of more than 20TiB:


Get-ClusterSharedVolume | select -Expand SharedVolumeInfo | select -Expand Partition -Property * | ft -auto FriendlyVolumeName,Name,FileSystem,@{ Label = "Size(GB)" ; Expression = { "{0:N2}" -f ($_.Size/1024/1024/1024) } },@{ Label ="FreeSpace(GB)" ; Expression = { "{0:N2}" -f ($_.FreeSpace/1024/1024/1024) } },@{ Label= "UsedSpace(GB)" ; Expression = { "{0:N2}" -f ($_.UsedSpace/1024/1024/1024) } },@{ Label = "PercentFree" ; Expression = { "{0:N2}" -f ($_.PercentFree) } }

FriendlyVolumeName        Name                                              FileSystem Size(GB)  FreeSpace(GB) UsedSpace(GB) PercentFree
------------------        ----                                              ---------- --------  ------------- ------------- -----------
C:\ClusterStorage\Volume1 \\?\Volume{f9c9ff4a-ecb6-413e-9236-f3518aca6ee1}\ CSVFS      11 263,98 6 320,76      4 943,22      56,11
C:\ClusterStorage\Volume2 \\?\Volume{62c90027-b6ec-4a1f-96e2-3bc8c569d539}\ CSVFS      10 239,98 7 200,91      3 039,08      70,32

or in bytes:

FriendlyVolumeName        Name                                              FileSystem Size(B)               FreeSpace(B)         UsedSpace(B)         PercentFree
------------------        ----                                              ---------- -------               ------------         ------------         -----------
C:\ClusterStorage\Volume1 \\?\Volume{f9c9ff4a-ecb6-413e-9236-f3518aca6ee1}\ CSVFS      12 094 608 965 632,00 6 786 867 920 896,00 5 307 741 044 736,00 56,11
C:\ClusterStorage\Volume2 \\?\Volume{62c90027-b6ec-4a1f-96e2-3bc8c569d539}\ CSVFS      10 995 097 337 856,00 7 731 914 801 152,00 3 263 182 536 704,00 70,32

In general, it is worth noting that calculating the storage overcommit in a cluster where virtual machines are hosted on CSV volumes needs to be done in a special way. We need to calculate the sum of the disk sizes of all virtual machines on each CSV volume and compare it with the size of this volume.

If anything, I'm ready to test the new plugin logic. Thank you.