Hi , I have an upgrade plan . All VMs in old vCenter will moved to new vCenter .
In the moving process the customized alarm definitions in the VM will be cleared.
Use Get-AlarmDefinition, I can know how many of customized alarm defintions.
But,
How to know an alarm definition have deployment to which VMs ?
Are you looking for alarms that have been explicitly defined on a VM or also alarms that have been inherited by a VM?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Use the following to determine which alarm are deployed to a specific VM.
Get-VM | Get-Alarmdefinition
If you only want the alarms defined explicitly on a VM you could do
Get-AlarmDefinition |
where{$_.ExtensionData.Info.Entity.Type -eq 'VirtualMachine'} |
select @{N='VM';E={$vm.Name}},Name
If you want all alarms for a VM, with an indication if they are inherited or not, you could do
Get-AlarmDefinition |
Select @{N='VM';E={$vm.Name}},Name,
@{N='Inherited';E={$_.ExtensionData.Info.Entity -ne $vm.ExtensionData.MoRef}},
@{N='DefinedOn';E={(Get-View -Id $_.ExtensionData.Info.Entity).Name}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference