VMware Cloud Community
kondrichRHI
Enthusiast
Enthusiast
Jump to solution

Alarm email address delimiter in VCSA 6.5 via PowerCLI 6.5.X

Hello,

we are using VCSA 6.5d (6.5.0.5500) and try to set alarm email responses to multiple recipients via PowerCLI (6.5 and 6.5.1).

However, multiple email addresses are seperated via semicolon by PowerCLI in vCenter that does not work: Emails are not delivered. The error message is:

The original message was received at Fri, 28 Apr 2017 09:52:54 +0200 from root@localhost

   ----- The following addresses had permanent fatal errors ----- email1@ourdomain.tld;email2@ourdomain.tld

   ----- Transcript of session follows -----

553 5.1.3 email1@ourdomain.tld;email2@ourdomain.tld... Invalid route address

Email alarm notifications are working when I set the delimiter to a comma in vCenter alarms configuration manually (i.e. email1@ourdomain.tld,email2@ourdomain.tld).

This is the original PowerCLI script used for setting up a notification for a single alarm:

$vCenterServer="ourvCenterServer"

Connect-VIServer -Server $vCenterServer -Protocol https -WarningAction SilentlyContinue | Out-Null

$sessionManager = Get-View -Id $global:DefaultVIServer.ExtensionData.Content.SessionManager

$sessionManager.SetLocale("en-US")

Get-AlarmDefinition -Name "Storage DRS recommendation" | New-AlarmAction -Email -To @('email1@ourdomain.tld','email2@ourdomain.tld')

For debugging reasons, I cut it down to:

$vCenterServer="ourvCenterServer"

Connect-VIServer -Server $vCenterServer

Get-AlarmDefinition -Name "Storage DRS recommendation" | New-AlarmAction -Email -To @('email1@ourdomain.tld','email2@ourdomain.tld')

But this did not help either.

I also executed that script with different region settings: German as my personal user is set to, and English region settings of another user under another Windows machine installed with English Windows version.

Please note that semicolon worked as delimiter for our previous vSphere 6.0 Windows(!) installation. Now we moved on to 6.5 vCenter appliance and it seems that it requires commas. That's fine, if it would work via PowerCLI.

So where is the problem here? How can we set up our alarms with PowerCLI (it would be too much effort to set them all manually).

Is this a PowerCLI bug? A vCenter bug? Isn't it a bug at all? Rather a settings issue?

Tags (1)
1 Solution

Accepted Solutions
cpatidar
VMware Employee
VMware Employee
Jump to solution

We verified and found the same issue over VCSA 6.5.

To workaround this issue you can create separate alarm actions for each individual email Id's

$emails = @('email1@ourdomain.tld', 'email2@ourdomain.tld')

foreach ($email in $emails) {

    Get-AlarmDefinition -Name "Storage DRS recommendation" | New-AlarmAction -Email -To $email

}

View solution in original post

6 Replies
LucD
Leadership
Leadership
Jump to solution

What happens when you cheat and do

Get-AlarmDefinition -Name "Storage DRS recommendation" |

New-AlarmAction -Email -To "email1@ourdomain.tld,email2@ourdomain.tld"


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

0 Kudos
kondrichRHI
Enthusiast
Enthusiast
Jump to solution

This does not work. You will get:

New-AlarmAction : Cannot bind parameter 'To' to the target. Exception setting "To": "Invalid email address: email1@ourdomain.tld,email2@ourdomain.tld"

At line:2 char:85

+ ... Action -Email -To "email1@ourdomain.tld,email2@ourdomain.tld"

+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : WriteError: (:) [New-AlarmAction], ParameterBindingException

    + FullyQualifiedErrorId : ParameterBindingFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.Alarm.NewAlarmAction

0 Kudos
cpatidar
VMware Employee
VMware Employee
Jump to solution

Can you add the space between the email ids and try:

Get-AlarmDefinition -Name "Storage DRS recommendation" | New-AlarmAction -Email -To @('email1@ourdomain.tld', 'email2@ourdomain.tld')

0 Kudos
kondrichRHI
Enthusiast
Enthusiast
Jump to solution

A space between the addresses does not help.

0 Kudos
cpatidar
VMware Employee
VMware Employee
Jump to solution

We verified and found the same issue over VCSA 6.5.

To workaround this issue you can create separate alarm actions for each individual email Id's

$emails = @('email1@ourdomain.tld', 'email2@ourdomain.tld')

foreach ($email in $emails) {

    Get-AlarmDefinition -Name "Storage DRS recommendation" | New-AlarmAction -Email -To $email

}

kondrichRHI
Enthusiast
Enthusiast
Jump to solution

Thank you cpatidar​ for this workaround and and for filing this as a bug in current version of VCSA 6.5.