aculed
Contributor
Contributor

Clear Alarms on all hosts in a cluster - PowerCLI

Jump to solution

Can someone please provide an example of how to make use of the new ESXi 6.7 API function ClearTriggeredAlarms as described here: https://vdc-repo.vmware.com/vmwb-repository/dcr-public/3325c370-b58c-4799-99ff-58ae3baac1bd/45789cc5...

Currently, I'm acknowledging alarms on all hosts within a cluster in a script, but I'd like to take that a step further and clear that specific alarm on all hosts as well.  I can't seem to get the filter right to do this appropriately.

Thanks!

23 Replies
scottD65
Contributor
Contributor

I know this is an old thread but is there a way to filter based on date?

Scenario: 

  1. reset all alerts
  2. currently active one retriggers.
  3. tech is called for an already existing alert issue (host down or something like that). 

Would be nice to filter based on date and only reset the older triggered alarms.   

Could you filter based on acknowledged alerts and only clear those?  Then possibly use another method to acknowledge the older alerts and then clear only the acknowledged alerts with this method?

 

 

This is the original solution posted by LucD which works great for clearing all triggered alarms. 

Note that you can specify different values for all three enums, depending on which alarms you want to clear.

 

$alarmMgr = Get-View AlarmManager

 

$filter = New-Object VMware.Vim.AlarmFilterSpec

$filter.Status += [VMware.Vim.ManagedEntityStatus]::red

$filter.TypeEntity = [VMware.Vim.AlarmFilterSpecAlarmTypeByEntity]::entityTypeVm

$filter.TypeTrigger = [vmware.vim.AlarmFilterSpecAlarmTypeByTrigger]::triggerTypeEvent


$alarmMgr.ClearTriggeredAlarms($filter)

0 Kudos
LucD
Leadership
Leadership

Afaik, this is still the only method that clears all alarms.

No option to clear a specific alarm.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

JAVUS
Contributor
Contributor

I would like to know if there is a way to reset to green for specific alarm to only a VM , I want to attach a script to alarm

0 Kudos
LucD
Leadership
Leadership

Afaik unfortunately no.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos