VMware Cloud Community
cb22
Contributor
Contributor

Display Alarm Action send email

Hi,

Does anyone know how I can list all my alarms that have the action type of Send Email activated?

When I used the CLI all I get is the "Send Email" being displayed and not the actual alarm that it relates to or the email address that is set on that alarm.

Thanks

0 Kudos
1 Reply
LucD
Leadership
Leadership

You could do something like this

foreach($alarm in Get-AlarmDefinition){

    Get-AlarmAction -AlarmDefinition $alarm -ErrorAction SilentlyContinue | Where{$_.ActionType -eq 'SendEmail'} |

    Select @{N='Alarm';E={$alarm.Name}},@{N='Mail To';E={$_.To -join ','}}

}


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

0 Kudos