VMware Cloud Community
Jimleslie1977
Contributor
Contributor

disable all Alarms at the VCenter level

Hi,

 

would it please be possible to get some assistance on a script to disable all alarms defined at the VCenter level we have about 250 and need to temporarlily pause all bar 2:

 

1. vSAN Health service alarm

and

2. UnManaged workload detected

these are already disabled.

 

Thanks for any support

0 Kudos
5 Replies
LucD
Leadership
Leadership

You could do something like this

Get-AlarmDefinition -Entity (Get-Folder -Name Datacenters) | 
where{$_.Name -NotMatch "^VSAN Health Service Alarm$|^Unmanaged workload detected"}
Set-AlarmDefinition -Enabled:$false -Confirm:$false 


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

0 Kudos
Jimleslie1977
Contributor
Contributor

Would this work with Alarms being defined at the VCenter level and not the Datcenter Level?

0 Kudos
Jimleslie1977
Contributor
Contributor

I have tried runnign that but Does not seem to make any change.  In the GUI disable is greyed out at the DC level, so i think the script needs to disable at the VC Level?  

 

Thanks again

0 Kudos
LucD
Leadership
Leadership

The Datacenters folder, a hidden folder, is the root of the vCenter.

Can you first check if there are any Alarms defined at the vCenter root.

Get-AlarmDefinition -Entity (Get-Folder -Name Datacenters) | Select Name


If yes, try disabling the 1st one that was found.

Get-AlarmDefinition -Entity (Get-Folder -Name Datacenters) | 
Select -first 1 | 
Set-AlarmDefinition -Enabled:$false -Confirm:$false

Do you see the 'Reconfigure Alarm" task appearing in the Web GUI under Recent Tasks?

If the Alarms are not defined at the root of the vCenter, you should find out where they are defined

Get-AlarmDefinition -Entity (Get-Folder -Name Datacenters) | Select Name,@{N-'Entity';E={$_.Entity.Name}}


Just as a reminder, make sure that you are connected with an account that has the privilege to change the Alarm configuration on the vCenter root.





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

0 Kudos
Jimleslie1977
Contributor
Contributor

thats a massive help thanks so much

0 Kudos