WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Automation / Managing VM snapshot retention policies using the VMware Event Broker Appliance (VEBA)

Managing VM snapshot retention policies using the VMware Event Broker Appliance (VEBA)

10.28.2021 by William Lam // 2 Comments

vSphere Snapshots is an amazing technology that has enabled our customers to do so many amazing things from application lifecycle and testing to operating system updates and many other use cases. Like any technology, if it is miss-used, the benefits can quickly turn into challenge or nightmare.

As Peter Parker once said, "With great power comes great responsibility" which I think is one way to summarize VM snapshot usage šŸ˜†


I am pretty sure that every VI Admin out there has at least one story about vSphere snapshots gone wrong. Due to the convenience, ease of use and some times miss-understanding of how vSphere snapshot works, it can lead to a number of issues including filling up your storage and impacting other running workloads.

Now, imagine if you could implement a snapshot retention policy for your VM(s) based on the size of a given snapshot or maybe the number of days the snapshot has existed? Would that not be cool!?

This was actually an idea I had been thinking about and after a discussion with my colleague Michael Gasch, I realized we can easily do so with a bit of event-driven automation using our VMware Event Broker Appliance (VEBA) solution to run scheduled job for managing snapshot policies for a set of VM(s). Knative, which is the underlying backend technology that powers VEBA has an event source called PingSource, that can help with this type of use case.

Just like you have an event from vCenter Server or VMware Horizon, where VEBA subscribe to and then run a function, a PingSource is an event that is produced with a fixed payload running on a cron schedule that can then run some function or code. Using this information, I was able to build a basic PowerCLI function that can be used to manage VM snapshot retention based on age of a snapshot and/or the size of a given snapshot. This function can be deployed to monitor a set of VM(s) and can have different policies and/or schedules and a really cool capability of Knative when needing to run scheduled functions.

For more details on how to deploy and set this up in your own environment, check out the VEBA github example function. This is provided as an example, you can certainly create a more advanced function to evaluate other criteria's before deleting a given snapshot including sending a Slack or Microsoft Teams notification prior to snapshot removal.

More from my site

  • NSX Alarms in vCenter Server using vSphere Events in vSphere 8
  • Heads Up - Potential missing vCenter Server Events due to sequence ID overflow
  • vSphere Event-Driven Automation using VMware Event Router on VMware Cloud on AWS with Knative or AWS EventBridge
  • Integrating VMware Event Broker Appliance (VEBA) with Zapier
  • How to configure Knative and containerd in VMware Event Broker Appliance (VEBA) to use a private registry?

Categories // Automation, vSphere Tags // snapshot, VMware Event Broker Appliance

Comments

  1. Bill Akins says

    10/29/2021 at 2:23 pm

    Hi William,
    Great work as usual! I got so sick of snapshot sprawl that I wrote a snapshot maintenance PS script that is keyed on snapshot names and dates, and it runs nightly. It will send an email to the system contact the day before snapshots are deleted, in case there is a business need to retain them longer. If so, the snapshot can be renamed. I like your idea of a Teams notification, I'll work on adding that function.
    You can take a peep here:
    https://github.com/bakins929/SnapshotMaintenance
    Thanks for your great articles!

    Reply
    • William Lam says

      10/29/2021 at 2:37 pm

      Thanks and look forward to seeing function Bill

      Reply

Thanks for the comment! Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • How to bootstrap ESXi compute only node and connect to vSAN HCI Mesh? 01/31/2023
  • Quick Tip - Easily move or copy VMs between two Free ESXi hosts? 01/30/2023
  • vSphere with Tanzu using Intel Arc GPU 01/26/2023
  • Quick Tip - Automating allowed and not allowed Datastores for use with vSphere Cluster Services (vCLS) 01/25/2023
  • ESXi with Intel Arc 750 / 770 GPU 01/24/2023

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2023

 

Loading Comments...