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.
You could use "run a command" and trigger a script with some parameters which then creates a custom e-mail.
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
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. |
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)