This action is based on python scripts using a dedicated configuration file.

HPA provides a default single implementation for this script having only one configuration file to duplicate and edit.

It is also possible to create multiple instances of a peer script/configuration files.

Prerequisites

  • Get the following information from your support :
    • smtp server host
    • smtp server port
    • smtp user & password (optional)
    • the email that will received the alerts mails
    • the email that will the source of alerts mails
    • the HPA portal URL
  • python3 must be available on HPA portal server

One global configuration

Setup mail

  • A default configuration exists in <HPA home>/default_config/alertscripts/mail/sendmail.properties
  • It must be copied to … <HPA home>/override_config/alertscripts/mail/sendmail.properties
  • … and updated:
smtp.server = <smtp server host>
smtp.port = <smtp server port>
smtp.username = <smtp user or let empty>
smtp.password = <smtp password or let empty>
smtp.from = <project@bank-example.com>
smtp.to = <support@bank-example.com>
smtp.subject.alert = Alert detected on HPA : ${alert_name}, severity = ${alert_status}, previous severity = ${alert_previous_status}
smtp.subject.ok = Alert back to normal on HPA : ${alert_name}, severity = ${alert_status}, previous severity = ${alert_previous_status}
hpa.external_url = <hpa portal url>

The hpa.external_url is very similar to the HPA_EXTERNAL_DNS of <HPA home>/environment.config - defined here

Leverage the existing alert action

The existing shell action Script mail sending with

  • refering ../../default_config/alertscripts/alert_mail_python.sh as shell command

as parameters

Multiple configurations

To create multiple email alert configurations, some files present in alertscirpts must be copied from default_config to override_config

Some files must not be modified:

  • send_alert_mail.py
  • parse_agents_utils.py
  • mail/sendmail.sh
  • mail/sendmail.py
  • mail/swaks

Some files must be modified:

  • alert_mail_python.sh shell file <the new shell file>.sh
  • mail/sendmail.properties properties file <the corresponding properties file>.properties

The shell file referring the properties file

A new action must be defined, referring <the new shell file>.sh

Edit the shell file

  • The default shell script <HPA home>/default_config/alertscripts/alert_mail_python.sh
  • must be copied to … <HPA home>/override_config/alertscripts/<the new shell file>.sh
  • … and updated:
SENDMAIL_CONFIG=$BASEDIR/mail/<the corresponding properties file>.properties

Setup mail

  • The default configuration existing in <HPA home>/default_config/alertscripts/mail/sendmail.properties
  • must be copied to … <HPA home>/override_config/alertscripts/mail/<the corresponding properties file>.properties
    • … and updated as previously detailed

Create a new alert action

Configure the linked shell action with

  • ../../override_config/alertscripts/<the new script file>.sh as Shell command

as parameters