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

VM Snapshots: This argument does not support the % unit #52

Closed K0nne closed 2 years ago

K0nne commented 2 years ago

Hello,

I want to use "TotalSnapshotSizeWarning" and "TotalSnapshotSizeCritical". According to the docs it is possible to use percentage units:

vars.IcingaCheckHyperVSnapshot_Object_TotalSnapshotSizeWarning = "30%" vars.IcingaCheckHyperVSnapshot_Object_TotalSnapshotSizeCritical = "40%"

When I do it, I get the following error:

*******************************************
**       Icinga for Windows v1.7.1       **
** Copyright (c) 2021 Icinga GmbH | MIT  **
** User environment DOMAIN\USER          **
*******************************************
icinga> Invoke-IcingaCheckHyperVSnapshot -verbosity 2 -TotalSnapshotSizeWarning "30%" -TotalSnapshotSizeCritical "40%"
[..]
\_ [UNKNOWN] FQDN
   \_ [OK] FQDN 14.01.2021 11:22:27
      \_ [OK] Snapshot Description: Checkpoint settings for the virtual machine.
      \_ [OK] Snapshot Name: FQDN - (01/14/2021 11:22:11)
      \_ [OK] Snapshot Size: 60.03KiB
   \_ [OK] FQDN C: Count: 1c
   \_ [OK] FQDN C: Snapshot count prediction: 681231c
   \_ [OK] FQDN C: Total Snapshot Size: 60.03KiB
   \_ [UNKNOWN] FQDN C: Total Snapshot Size: This argument does not support the % unit
   \_ [OK] FQDN: Latest Snapshot Creation Delta: 361.15d
   \_ [OK] FQDN: Latest Snapshot Description: Checkpoint settings for the virtual machine.
   \_ [OK] FQDN: Latest Snapshot Name: FQDN - (01/14/2021 11:22:11)
[..]

image

LordHepipud commented 2 years ago

Hello

Thank you for the issue. I think this is a documentation error. We have no base value to compare the total snapshot size to. We could add the partition size the snapshots are located on as base value, which would then offer the % unit to work.

Is this what you would expect?

aheinhold commented 2 years ago

Hello @LordHepipud

the required base value haves to be the size of the snapshotted vm disk.

LordHepipud commented 2 years ago

Hello

I'm not sure if this makes sense. The Total Snapshot size is the sum of every single snapshot created for this virtual machine on the local disk/storage of the Hyper-V.

Is it beneficial to know, that the Snapshot Size is a certain % value of the size of virtual disk of the VM or the storage location it is placed on?

I honestly don't know, that's why I ask.

LordHepipud commented 2 years ago

Fun fact: I just figured out, that there are two packages with the same entry. For one with the BaseValue of the current partition size and one without, which is the one throwing the error.

aheinhold commented 2 years ago

I'm not sure if this makes sense.

Unfortunately I do not know that either.
I asked my colleagues from the hyperv team and got this information.
I asked again if I understood correctly and it was confirmed.

LordHepipud commented 2 years ago

I just updated the linked PR. The metric is now using the disk sizes of the VM as base value. Could you please test this?

aheinhold commented 2 years ago

I tested the PR. Now i can set threshold values as expected. Thank you @LordHepipud