Sending e-mails

Linux > Sending e-mails  
 

  • Make sure you have root rights.
  • Edit the psp_ntf file in the PSP default installation directory (/usr/upsman/psp).
  • At the beginning of the script, fill in the mandatory variables ("smtpServer" and "to") that have been passed to the psp_mail function.
  • The variables "from", "object", and "message" have already been filled in. You can however change them.
  • Select the event(s) for which you wish to receive an e-mail.
  • Decomment or duplicate the call to the psp_mail function depending on the events for which you wish to receive one or more e-mails.
    Events list

    Correspondence with
    psp_ntf script

    Utility failure UtilityFailure
    Utility restored UtilityRestored
    Battery fault BatteryFault
    UPS on Bypass OnBypass
    Return from bypass ReturnFromBypass
    Overloaded Overload
    UPS Battery low LowCondition
    Check or replace UPS battery ControlBattery
    Communication lost with UPS CommFailure
    Communication restored with UPS CommRestored
    System shutdown initiated ShutdownBeginning
    System shutdown in %d ShutdownDelay


Example of e-mail received (after a "Utility failure" event):


Note:

 

  • To check whether the e-mail has been sent: edit the "psp_log.log" file in the PSP installation directory.
  • To send several e-mails for an event, create several "to" variables (to1, to2, etc.) and duplicate the call of the psp_mail function, replace the old "to" variable with the new one, for example "to1".

Example:

# *********************************************************************
# * To receive emails on UPS Events perform the following 2 steps :
# *********************************************************************

# *********************************************************************
# * step 1) Initialize "smtpServer" and "to" variables
# set the "smtpServer" variable with your smtp server name or its IP address
smtpServer=example.smtp
# set the "to" variable with your email's receiver address
to=example@example.com

to1=example1@example1.com

# Email's sender is pre-configured with your hostname
from="$HOSTNAME"
# Email's object and message are pre-configured with UPS alarm event
object="EATON Personal Solution Pac : UPS alarm $4"
message="EATON Personal Solution Pac : UPS alarm $4"
# *********************************************************************

# *********************************************************************
# * step 2) Select the event for which you want to receive the email
# * remove '#' symbol or paste the psp_mail command related to the event
# *********************************************************************


case "$messageName" in
"UtilityFailure")
$PSP_PATH/psp_brdc "$messageName" "$sendYesNo" "$date" "$4"
# to receive an email on UtilityFailure event remove the next '#' symbol
$PSP_PATH/psp_mail -s "$smtpServer" -f "$from" -t "$to" -o "$object" -m "$message"
$PSP_PATH/psp_mail -s "$smtpServer" -f "$from" -t "$to1" -o "$object" -m "$message"

see:
Customization of events and actions

Examples of customization for Linux
(Graphic popups and on screen display)

 

  See also :

Install PSP
Launch PSP-Console
Test PSP
Sending e-mails
Advanced features
Uninstall PSP