Creating a vm specific alert for when a snapshot is reverted
search cancel

Creating a vm specific alert for when a snapshot is reverted

book

Article ID: 390389

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

There is no way to create an alarm in vCenter for a VM snapshot revert.

Environment

VMWare vCenter Server 7.x
VMWare vCenter Server 8.x

Cause

There is no way to create an alarm in vCenter for a snapshot revert, but you can in Power CLI.

Resolution

Install PowerCLI by following: PowerCLI installation guide

Connect to vCenter server using PowerCLI:  Connect-VIServer <vCenter IP or FQDN>

Run the following commands in order:
1.  $eventType = Get-EventType | Where {$_.id -eq 'EventType-EventEx;FullFormat-com.vmware.vc.vm.VmStateRevertedToSnapshot'} # use Get-EventType to filter for a specific task event

2.  $eventTrigger = New-AlarmTrigger -EventType $eventType -EntityStatus Yellow -EntityType VirtualMachine

3.  New-AlarmDefinition -Name "<Desired alert name>" -Description "<Desired description>" -Entity (Get-VM <VM-Name>) -Trigger $eventTrigger

Additional Information

This info came from William Lam's blog (Distinguished Platform Engineering Architect in VCF at Broadcom), see Creating vCenter Alarms based on task events for more information