Contributor
Contributor

Report or listing on all host and clusters with alarm actions disabled

Having a persistent problem with teammembers forgetting to re-enable alarm actions at the host and cluster level.

Anyone know of script that will list or report all hosts and clusters with alarm actions set to "disabled"? 

thx,

0 Kudos
7 Replies
Leadership
Leadership

Try something like this

Get-AlarmDefinition | where {!$_.Enabled} | 
Select
Name,Description,Entity


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

0 Kudos
Contributor
Contributor

That's alarm definition, so it's reporting on an alarm item.  I'm looking for the idenfication of Alarm Actions that are enabled/disabled.

thx for the reply.

0 Kudos
Leadership
Leadership

Sorry, not following I'm afraid.

Can you give a sample screenshot of a 'disabled' action in an alarm ?


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

0 Kudos
Contributor
Contributor

By right clicking on a DC, Cluster or Host, ou can disable/enable Alarm actions.  I want to use a script to automate this at each level:  To report on all that are enabled disabled, and change the state to enabled or disabled.

alarm actions screencap.jpg

thx,

0 Kudos
Leadership
Leadership

Just created some functions, have a look at Alarm actions – enable – disable – report


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

0 Kudos
Contributor
Contributor

Thanks for the work you put into this, but I can't get it to work.

I'm running PowerClI 5.1 r2.  I save your code as a ps file and run it and get nothing.

If I try to run the following samples

1$cluster = Get-Cluster Cluster1
2Get-AlarmActionState -Entity $cluster -Recurse:$false

I get errors with anything referencing AlarmActionState: "....is not recognized as the name of a cmdlet, function, script file.....

0 Kudos
Leadership
Leadership

Did you dot-source the 2 functions from my post ?

If not, please the functions in a .ps1 file (for example AlarmActions.ps1), and then dot-source the .ps1 file

PS C:\Scripts> . ./AlarmActions.ps1

This assumes you stored the .ps1 file in the folder C:\Scripts.

Once that is done you should be able to call both functions


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

0 Kudos