Howto configure Postoffline trigger under Veritas Cluster Server

Posted on November 26, 2012


– My Lab Environment

OS = rhel 6.2

SFHA = 6.0

– Introduction to SSMTP utility:

SSMTP is a program to deliver an email from a local computer to a configured mailhost (mailhub)/gmail. One of its primary uses is for forwarding automated email (like system alerts) off your machine and to an external email address.

– Installation:

#yum install ssmtp

– Configuration file:


– Configuration:

To configure SSMTP, you will have to edit its configuration file (/etc/ssmtp/ssmtp.conf) and enter your account settings:

# The user account that sends all the mails

# The mail server (where the mail is sent to), usually on port 587

# Use SSL/TLS before starting negotiation 

# Username/Password
AuthUser=username of gmail account
AuthPass=password of gmail account

– Creating Aliases:

Create aliases for local user-names in /etc/ssmtp/revaliases configuration file:

- Sending mails:
A simple method to send emails is to create a text file(filename.txt) containing the following:

Subject: Test

This is a test mail.
Now execute the following command from Linux shell :
#ssmtp < filename.txt

- POSTOFFLINE script in VCS:
This event trigger is invoked on the system where the group went offline from a partial or fully online state. This trigger is invoked when the group faults, or is taken offline manually.

In the properties of ClusterServiceGroup, set the TriggersEnabled attribute to “POSTOFFLINE”
This will trigger the POSTOFFLINE trigger of VCS whenever the ClusterServiceGroup gets faulted or goes offline.

- Editing the POSTOFFLINE script:

Copy the postoffline script from /opt/VRTSvcs/bin/sample_triggers to /opt/VRTSvcs/bin/triggers

#vi /opt/VRTSvcs/bin/triggers/postoffline

Append the following line at the end of the script:

which is a Perl system call that further executes a Linux Bash script “” is a single statement bash script containing the ssmtp command:
ssmtp < file.txt

This shell script sends emails to all the recipients listed in the file.txt

Whenever the notifier resource is turned off or gets faulted, POSTOFFLINE trigger is executed that sends email to designated recipients.

- What happen if you did not configure the alias

( Please Note: At this point I am confident that my trigger was executing. See a snapshot of engine log:
INFO V-16-6-15002 (node1) hatrigger:hatrigger executed /opt/VRTSvcs/bin/triggers/postoffline node1 successfully )
The flow of emails from the postoffline trigger is like this Cluster Node => Gmail => domain account where you are willing the user receive email. So If you did not configure the alias when happens that the gmail will receive a request to send an email to username@Clusternodename. At this pointthe mail will be bounce back as the ClusterNodeName will not be the valid host name. This clue I found when my gmail account receive a Delivery failed message. See the below for your reference:

Posted in: SFHA / VCS