VMware Cloud Community
uswbnc53
Enthusiast
Enthusiast

Customized vCenter SMTP Subject Line

Is there a way to modify the smtp subject line when an alarm is triggered? Either, by config file, or PowerCLI. Our ticketing system will only generate tickets from smtp messages with the subject line in a specific format.

0 Kudos
4 Replies
nielse
Expert
Expert

You could use "run a command" and trigger a script with some parameters which then creates a custom e-mail.

@nielsengelen - http://foonet.be - VCP4/5
0 Kudos
uswbnc53
Enthusiast
Enthusiast

Right.... but, I'm not seeing a easy to way to capture the event from which the alarm was triggered.

Target: hostname
Previous Status: Green
New Status: Red

Alarm Definition:
([Red state Is equal to notResponding] AND [Red state Not equal to standBy])

Current values for metric/state:
State = Not responding AND State = Unknown

Description:
Alarm 'Host connection and power state' on hostname changed from Green to Red

0 Kudos
nielse
Expert
Expert

I have a somewhat a like blog post about this at http://foonet.be/2012/05/24/sending-vcenter-alarm-notifications-to-jabber/. The only difference is that the action which happens is that the event gets pushed to a jabber account.

As you can see the action parameters are the following:

"c:\Program Files (x86)\PHP\php.exe" "c:\Monitoring\sendmessage.php" {targetName} {eventDescription}

As you can see there are 2 parameters being used. 1 being the targetname and 1 being the description. Just make a bat or php file which sends the e-mail for you.

You can use the following parameters:

{eventDescription}

Text of the alarmStatusChange event. The {eventDescription} variable is supported only for Condition and State alarms.

{targetName}

Name of the entity on which the alarm is triggered.

{alarmName}

Name of the alarm that is triggered.

{triggeringSummary}

Summary info of the alarm trigger values.

{declaringSummary}

Summary info of the alarm declaration values.

{oldStatus}

Alarm status before the alarm is triggered.

{newStatus}

Alarm status after the alarm is triggered.

{target}

Inventory object on which the alarm is set.

@nielsengelen - http://foonet.be - VCP4/5
0 Kudos
uswbnc53
Enthusiast
Enthusiast

Found the answer to my issue. You can set the Subject through PowerCLI

Get-AlarmDefinition "Host storage status" | New-AlarmAction -Email -To “me@mycompany.com”  -Subject "Host storage shortage" # This will create a send email action  which will be triggered once when the alarm state changes from warning  (yellow) to alert (red)

0 Kudos