Smarts SAM: How to create an email script to send email notifications as part of a Smarts SAM escalation policy
search cancel

Smarts SAM: How to create an email script to send email notifications as part of a Smarts SAM escalation policy

book

Article ID: 327759

calendar_today

Updated On:

Products

VMware

Environment

VMware Smart Assurance - SMARTS

Resolution

How to create an email script to send email notifications as part of a Smarts SAM escalation policy



To create an email script as part of a Smarts SAM escalation policy, you need to create an email.sh in the following directory:

<BASEDIR>/SAM/smarts/local/actions/

For the email script itself, you can copy and paste the following code into the email.sh file and modify according to your requirements:

#!/bin/sh
#set -x

export target="$SM_OBJ_ClassName $SM_OBJ_InstanceDisplayName $SM_OBJ_EventName"
export subject="SMARTS Fault on $SM_OBJ_ClassName $SM_OBJ_InstanceDisplayName $SM_OBJ_EventName $SM_OBJ_UserDefined1"

if [ "$SM_OBJ_EventState" = "INACTIVE" ]
then
    export subject="SMARTS Fault CLEARED! on $SM_OBJ_ClassName $SM_OBJ_InstanceDisplayName"
fi

export msg="$DATE $TIME CDT: A SMARTS Fault has occurred on: $target Description: $SM_OBJ_EventText"

if [ "$SM_OBJ_EventState" = "INACTIVE" ]
then
    export msg="$DATE $TIME CDT: SMARTS Alert on: $target has been CLEARED!"
fi

export whoToMail=<to-email-address>
export senderPerson=<from-email-address>
export mailServer=<smtp-ip-or-name>

export DMCTL="$SM_HOME/bin/dmctl -s $SM_SERVER_NAME "

$DMCTL put ACT_Mail::ACT-Mail::SMTPServer $mailServer
$DMCTL invoke ACT_Mail::ACT-Mail sendmail "$senderPerson" "$whoToMail" "$subject" "$msg"