Configuring alarms on all VMware alarm definitions automatically using PowerShell

 

My example contains alarm actions to send an email, but you can configure this for SNMP or any other actions. You can copy and paste this into a “.ps1” file to create a PowerShell scripts.

# This command will remove any alarms actions that are configured currently.

Get-AlarmDefinition | Get-AlarmAction | Remove-AlarmAction -confirm:$false

 

#This command will add an alarm action to send an email. It automatically adds the trigger for status "Yellow" to "Red".

Get-AlarmDefinition | New-AlarmAction -Email -To 'Email@Email.com'

 

#This command adds and additional trigger to send an email when the the status changes from "Yellow" to "Green"

Get-AlarmDefinition | Get-AlarmAction -ActionType "SendEmail" | New-AlarmActionTrigger -StartStatus "Yellow" -EndStatus "Green"

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>