Before the addition of Automation Central to VMware Aria Operations (formerly VMware vRealize Operations), I had created my own method of cleaning up outdate snapshots. I documented this method of executing VMware Aria Automation Orchestrator workflows to remediate alerts in my blog post from 2019 titled Automated Alert Remediation in vRealize Operations 7.x using vRealize Orchestrator. This process involved creating an alert in VMware Aria Operations that would be generated when a snapshot reached a specific age. Then this alert had an automated remediation action tied to it. The automated remediation action was a custom VMware Aria Automation Orchestrator (formerly VMware vRealize Orchestrator) workflow that would query the VM for snapshots and delete any snapshots older than the same specified time period. While this process has served me well for many years, there is now a much easier way to accomplish the same task.
Several releases ago, VMware added Automation Central to VMware Aria Operations, allowing a limited selection of scheduled jobs to be executed against virtual machines. One of the available jobs is the Delete old snapshots job. In this blog post, I explore the options available within the new VMware Aria Operations 8.12 release for automating the cleanup for virtual machine snapshots using the Automation Central feature.
Aria Operations Automation Central is a feature that allows scheduling various virtual machine automation jobs. These jobs can include powering on VMs, powering off VMs, powering off idle VMs, deleting idle VMs, downsizing VMs based on Aria Operation’s recommendations, and upsizing VMs based on VMware Aria Operation’s recommendations. Each of the job types provides various options specific to the job goal, the ability to scope the job to various parts of your infrastructure, such as an entire cluster or individual virtual machine, the ability to apply filters to the set objects included, and finally the ability to schedule the job. Supported schedule intervals are one-time, daily, weekly, or monthly. Additionally, you can specify an optional end date for repeating schedules.
Because the topic of this blog post is the automated cleanup for snapshots, let’s get right to it. The process’s first step is adding a new job to Automation Central. We click the ADD JOB button to begin this process. This loads the Create New Job wizard. We define a title for this job, select the Delete old snapshots bullet for the Action Configuration and accept the default settings for the job. The default and minimum age allowed by Automation Central is 7 days based on the default configuration defined within your Reclamation Settings (defined by selecting Optimize -> Reclaim from the left side navigation, then clicking SETTINGS from the top of the page). Additionally, we could add additional requirements, such as a minimum snapshot size or filter based on the snapshot name (new to version 8.12). Click the NEXT button to move to the Select Scope step of the wizard.
This step in the wizard allows us to specify what objects this job will be executed against. The selection process allows you to select multiple objects, such as individual virtual machines, clusters, or vCenter Server instances. From here, you can drill down into your VMware Aria Operations inventory and be as specific as you need to be. In this example, I will apply the job to an entire vCenter Server instance by dragging it to the left side of the screen.
Now that I have defined the scope for this job to apply to all virtual machines within my vCenter Server instance, I click the NEXT button to move on to the Filter Criteria step of the wizard. This step in the wizard allows us to define additional filters to determine which virtual machines will have their snapshots cleaned. The filters are defined similarly to custom groups within VMware Aria Operations. These filters can be based on metric values, relationships, property values, object values, and tags. Filters can be grouped and combined into and/or configurations as needed. In this example, I will add a filter based on the object name to exclude my vCenter Server virtual machine named VCENTER from the job. Assuming that you might have multiple virtual machines that should never have snapshots removed in an automated fashion, you could easily add a tag within the vCenter Server and add that as a filter during this step.
To determine if your scope selection and filters are working as expected, click the PREVIEW SCOPE button at the bottom right of the screen to see a list of objects your configuration includes.
Now that my filters are defined, I click the NEXT button to move to the final step in the wizard, which allows for job scheduling. In this example, I would like the job to run once a day at 4 AM with no specified end date. Since this job will be scheduled for 4 AM, the UI requires that I select tomorrow as the first day for the schedule, as 4 AM today is no longer a valid start time. I have the option to specify a specific time zone, but in this example, I will accept the default, which is to use my web browser’s time zone. I select Daily for the recurrence and specify 1 Day (s) for the Run Every value. This configures the job to run every day. You could set a different value here, such as 2 Days (s), to configure the job to run every other day. I leave the End field blank so that this job continues to run forever! Finally, there is an option to have VMware Aria Operations send notification emails on success, failure, and a reminder 2 hours before the job is scheduled to run. If you select this checkbox, you are provided the option to choose your preferred email outbound plugin, as well as provide the email address where the notifications will be sent.
Now that all of the configurations for the job have been specified, I click the CREATE button to create the scheduled job. This returns me to the main Automation Central screen showing my new job listed on the calendar for each and every day going forward.
Clicking on any of the job items listed in the calendar, VMware Aria Operations provides details on the job’s schedule, type of action, whether or not the job is activated, the ability to edit the job, activate/deactivate the job, or preview the virtual machines affected by the job.
Additionally, if I select the Jobs tab, the new job will be listed with the ability to edit, delete, clone, or deactivate the job.
With that, we now have automated clean-up of any snapshot older than 7 days within the vCenter Server. If you wanted the job to run more frequently than daily, such as twice a day, you would need to create a clone of the job and schedule each job for separate times. I would caution against scheduling duplicate jobs too closely to each other as large snapshots can take a while to be removed. My other item of caution would be the possibility that the automation could affect many virtual machines simultaneously, which could cause a significant increase in I/O against your storage system as the snapshots are all removed. I haven’t tested it, but I hope VMware built in the intelligence for VMware Aria Operations to throttle the number of tasks executed at a single time.
One item I would love to see added to Automation Central is the ability to run other actions against a virtual machine, such as a specific increase/decrease in CPU/memory resources, or the ability to schedule the execution of VMware Aria Automation Orchestrator workflows.
Search
Get Notified of Future Posts
Recent Posts