In vSphere Client on a VM host in the Alarms tab there is a view of Triggered Alarms.
How can I get those alarms using PowerCLI?
In vSphere Client on a VM host in the Alarms tab there is a view of Triggered Alarms.
How can I get those alarms using PowerCLI?
this is what i use.
To find all vmhosts with alarm status = "red", I expanded on this.
To expand a bit on johnshen64's PowerCLI answer, I found Luc Dekens' post on communities.vmware.com to be very helpful:
... and I ended up using a variation of that:
The idea is to loop through each top-level entity that the alarms could roll up to. I discovered through trial and error that
Get-VDSwitch
andGet-Datacenter
covered what I needed. The other tricky part is to realize that the Entity and Alarm objects inside the alarm are references to the actual objects, so to get details about the actual item, you have to dereference it withGet-View
.