VMware Cloud Community
Treasure
Contributor
Contributor

How to know an alarm have deployment to which VMs ?

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 ? 

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership

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

Reply
0 Kudos
RoderikdeBlock
Enthusiast
Enthusiast

Use the following to determine which alarm are deployed to a specific VM.

Get-VM | Get-Alarmdefinition

Roderik de Block


Blog: https://roderikdeblock.com
Reply
0 Kudos
LucD
Leadership
Leadership

If you only want the alarms defined explicitly on a VM you could do

Get-VM -PipelineVariable vm|

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-VM -PipelineVariable vm|

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

Reply
0 Kudos