Forum Discussion

Kelemvor's avatar
Icon for Expert rankExpert
3 months ago

Anyone know of a way to monitor for SNapshot age on a Hyper-V machine?

We have some checks that monitor our VMWare system for Snapshots.  Once they are over 72 hour old, we get an alert. I haven’t been able to find a way to do the same thing for our Hyper-V servers.  Does anyone happen to know if that’s possible?  I didn’t see anything in the Exchange but just through I’d ‘check in case someone knew of anything.

I can pull the data with Powershell via the get-vm|get-vmsnapshot command.  Not sure if that’s usable in LM somehow.


4 Replies

  • I didn’t see anything in Exchange either but you should be able to run that powershell command in a datasource, perhaps via Invoke-Command to the Hyper-V server. Then calculate the age from CreationTime of the checkpoint and provided that as a datapoint to LM.

  • Yep, that’s it. Invoke-Command -computer <hyper-v name/ip>. Remember the powershell runs on the collector, which is why you need to run it remotely, unless the get-vm|get-vmsnapshot cmdlet has a remote option built in. 

    I suggest a discovery script that would list out either the VMs or the snapshots (probably the VMs) and a batchscript collection script that lists out the age of the oldest snapshot on the VM (or the age of each snapshot if your discovery lists each snapshot individually).

  • You’ll likely end up with two scripts, a discovery script and a collection script.


    This script is meant to enumerate the instances to LogicMonitor. The goal is to output a list of the objects you’ll be monitoring. Depending on how you want to do it, this will either be the list of VMs or the list of snapshots. This PS script would execute on the collector, but use the invoke-command with the -computer argument to actually execute the command remotely on the target HPV. The output will be multiple lines, where each line represents a VM or snapshot. 

    You could list the snapshots using the get-vmlget-vmsnapshot command. The required output is described here. I recommend ticking the box that says “Use Wildvalue as Unique Identifier” (I’ll explain if you’re interested why). Tick the “Multi-instance” and “Enable Active Discovery” tickboxes. Then you can select “Embedded PowerShell Script” and paste in your script. I recommend testing your script on the collector debug console since the test options on the DS editor aren’t conducive to actual debugging.

    I recommend setting a property on the instance containing the name of the VM the snapshot belongs to. This will allow you to auto-group the instances by VM.


    This script will be very similar to the discovery script; it will use the invoke-command with the -computer argument to run on the collector but execute on the target HPV remotely. The output syntax is described here.

    Your datapoints would use the “multi-line key value pairs” processor and the key would look like this: ##WILDVALUE##.<datapointname> where <datapointname> is the part that comes after the dot and before the equals sign in your script output.

    I’m not a powershell guy, so someone else might have to get you started with template scripts. 

  • I’ve never created anything like this before.  Do I just run the script and LM will parse it and figure things out?

    We have all our HPV Hosts in a group so I could point something at the group, or apply it based on the name.  If I run get-vm|get-vmsnapshot on the host, it gives me all the info I need in a table.  Would need to check the date column and convert that to Age In Hours.   Would need to put all the data into the Raw Data and then set an alert for Age In Hours > 72 I guess.

    Does  anyone have an example of something similar i could look at to see how this should work?