Home Orchestrator

Monitoring VM Snapshots

alex_kokinalex_kokin Member IT Monkey ✭

Might anyone know how to create a monitor for VM snapshots or point me to a good resource?

Answers

  • Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭

    Can you define more about what you mean about Monitor for VM snapshots?

    What platform Hyper-V or vSphere?

  • alex_kokinalex_kokin Member IT Monkey ✭

    My Orchestrator is connected to the VSphere sorry.

    What I want to do is monitor for VM's that have old snapshots. I then what Notify / Approve the removal of all the old snapshots.

  • Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭

    I have something similar.

    I have a Runbook that I run once a day, via a PowerShell Scheduled task so I do not eat up a monitor Runbook. Each morning it kicks off and the Runbook has a PowerShell task the queries vSphere Rolling thru the different folders and server groups.

    Create a PowerShell script that connects to the vSphere host, rolls their your use case needs and locates the snapshots based on X filters. Then output into a variable to pass into the Runbook to create a new SR with workflow process or your business process.

    The basics of the script are

    Make sure your SCORCH service account has rights in vSphere

    Install the PowerCLI into the Runbook host server instances.

    Powershell script

    if ( !(Get-Module -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) ) {

    . "C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"

                    }

    $VSphere = 'vspherehost.domain.local'

    $VApp = 'DomainApp'

    $VMS = Get-VApp -Name $VApp | Get-VM

    foreach ($VM in $VMS) 

    {

    $Snapshot_Remove = Get-Snapshot -VM $VM -ErrorAction SilentlyContinue | Select-Object -First 1

    }

    DisConnect-VIServer $VSphere -Force -confirm:$false

    Now the $Snapshot_Remove will be an array of values so you will need to parse it out to the data points you need in the next steps of the Runbook.


    HTH

  • alex_kokinalex_kokin Member IT Monkey ✭

    Thank you, I will have a look.

Sign In or Register to comment.