Hyper-V Snapshot creation time check does not work?

Hi,
if i execute this command von my hyper-v server
icinga { Invoke-IcingaCheckHyperVSnapshot -ActiveVms -IncludeVms '*vm*' -Verbosity 2 -CreationTimeWarning 7776000 }
The documentation says the time is in seconds. To the 7776000 seconds are 90 days.
But the output shows

[OK] VM Snapshots: 31 Ok
_ [OK] pcvmtestBM01
_ [OK] pcvmtestBM01 08.11.2024 09:54:13
_ [OK] Snapshot Description: Prüfpunkteinstellungen für den virtuellen Computer.
_ [OK] Snapshot Name: pcvmtestBM01 - (24.10.2024 - 17:10:18)
_ [OK] Snapshot Size: 51.66KiB
_ [OK] pcvmtestBM01 15.04.2025 12:24:37
_ [OK] Snapshot Description: Prüfpunkteinstellungen für den virtuellen Computer.
_ [OK] Snapshot Name: pcvmtestBM01 - domain.de u. local User (14.04.2025 - 17:26:16)
_ [OK] Snapshot Size: 51.80KiB
_ [OK] pcvmtestBM01 C: Count: 2c
_ [OK] pcvmtestBM01 C: Snapshot count prediction: 7366765c
_ [OK] pcvmtestBM01 C: Total Snapshot Size: 103.46KiB
_ [OK] pcvmtestBM01: Latest Snapshot Creation Delta: 57.13d
_ [OK] pcvmtestBM01: Latest Snapshot Description: Prüfpunkteinstellungen für den virtuellen Computer.
_ [OK] pcvmtestBM01: Latest Snapshot Name: pcvmtestBM01 - domain.de u. local User (14.04.2025 - 17:26:16)

So, you can see that the initial snapshot is much older then 90 days. Did anyone know where my issue is, or is that a bug and i should open a issue on github?

Hello,

Thank you very much for your reply. What exactly would you like to achieve in this example?
The output of the plugin is correct, because 57.13d is lower than your 90d threshold.

If you want to get a notification if the last snapshot is lower than 90d, you will have to add a : at the end of the threshold to change the internal comparison, example:

icinga> Invoke-IcingaCheckHyperVSnapshot -ActiveVms -IncludeVms 'netsalesgln1' -Verbosity 2 -CreationTimeWarning '90d:';

[WARNING] VM Snapshots: 1 Warning [WARNING] netsalesgln1
\_ [WARNING] netsalesgln1
   \_ [OK] Base 02.04.2025 09:34:31
      \_ [OK] Snapshot Description: Checkpoint settings for the virtual machine.
      \_ [OK] Snapshot Name: Base Installation
      \_ [OK] Snapshot Size: 51.82KiB
   \_ [OK] Graylog 11.04.2025 10:07:43
      \_ [OK] Snapshot Description: Checkpoint settings for the virtual machine.
      \_ [OK] Snapshot Name: Graylog Installed
      \_ [OK] Snapshot Size: 52.95KiB
   \_ [OK] MongoDB 04.04.2025 09:02:50
      \_ [OK] Snapshot Description: Checkpoint settings for the virtual machine.
      \_ [OK] Snapshot Name: MongoDB Installed
      \_ [OK] Snapshot Size: 52.76KiB
   \_ [OK] netsalesgln1 D: Count: 3c
   \_ [OK] netsalesgln1 D: Snapshot count prediction: 1710742c
   \_ [OK] netsalesgln1 D: Total Snapshot Size: 157.53KiB
   \_ [WARNING] netsalesgln1: Latest Snapshot Creation Delta: Value 62.15d is lower than threshold 90d
   \_ [OK] netsalesgln1: Latest Snapshot Description: Checkpoint settings for the virtual machine.
   \_ [OK] netsalesgln1: Latest Snapshot Name: Graylog Installed
| netsalesgln1::ifw_hypervsnapshotdata::count=3c;;;; netsalesgln1::ifw_hypervsnapshotdata::prediction=1710742c;;;; netsalesgln1::ifw_hypervsnapshotdata::summary=161307B;;;0;12953060000 netsalesgln1::ifw_hypervsnapshotvm::created=5369965s;7776000:;;;

If you want to receive alerts if the last snapshot is greater than your threshold, you can use the threshold as you did, you will just need to lower the time.

icinga> Invoke-IcingaCheckHyperVSnapshot -ActiveVms -IncludeVms 'netsalesgln1' -Verbosity 2 -CreationTimeWarning '60d';

[WARNING] VM Snapshots: 1 Warning [WARNING] netsalesgln1
\_ [WARNING] netsalesgln1
   \_ [OK] Base 02.04.2025 09:34:31
      \_ [OK] Snapshot Description: Checkpoint settings for the virtual machine.
      \_ [OK] Snapshot Name: Base Installation
      \_ [OK] Snapshot Size: 51.82KiB
   \_ [OK] Graylog 11.04.2025 10:07:43
      \_ [OK] Snapshot Description: Checkpoint settings for the virtual machine.
      \_ [OK] Snapshot Name: Graylog Installed
      \_ [OK] Snapshot Size: 52.95KiB
   \_ [OK] MongoDB 04.04.2025 09:02:50
      \_ [OK] Snapshot Description: Checkpoint settings for the virtual machine.
      \_ [OK] Snapshot Name: MongoDB Installed
      \_ [OK] Snapshot Size: 52.76KiB
   \_ [OK] netsalesgln1 D: Count: 3c
   \_ [OK] netsalesgln1 D: Snapshot count prediction: 1712537c
   \_ [OK] netsalesgln1 D: Total Snapshot Size: 157.53KiB
   \_ [WARNING] netsalesgln1: Latest Snapshot Creation Delta: Value 62.15d is greater than threshold 60d
   \_ [OK] netsalesgln1: Latest Snapshot Description: Checkpoint settings for the virtual machine.
   \_ [OK] netsalesgln1: Latest Snapshot Name: Graylog Installed
| netsalesgln1::ifw_hypervsnapshotdata::count=3c;;;; netsalesgln1::ifw_hypervsnapshotdata::prediction=1712537c;;;; netsalesgln1::ifw_hypervsnapshotdata::summary=161307B;;;0;12953060000 netsalesgln1::ifw_hypervsnapshotvm::created=5370154s;5184000;;;

By the way, please note that you can write your time as 7776000, but you can also write 90d. The Icinga for Windows plugins will automatically translate those values properly.

I hope this helps. If you have more questions, please feel free to ask them.

Thanks for your reply. The plugin seems just checking the latest snapshot, right? As you see in my output the first snapshot is above 300d.

Ahhh, I see - yes. It only takes the last snapshot.
So, you would want an option to check all snapshots attached to a virtual machine?

We could maybe change this with an additional argument. Would this be suitable?