You are here: 17 Object Triggers > How-to > Using a Trigger to Send Email

17.3 Using a Trigger to Send Email

To use a trigger to send email

  1. For objects that send mail to the primary user, you must configure the Moab administrator email using the MAILPROGRAM parameter.
  2. Create a trigger on one of the four valid objects listed below, setting the AType to mail and the Action to the body of the message inside of quotation marks.
  3. Object Recipient
    Node The primary user (the first user listed in ADMINCFG[1], typically root)
    Job The job's owner
    Reservation The primary user
    Scheduler The primary user
  4. When attaching a mail trigger to all objects of a certain type, use internal variables in the Action to add information that is specific to an object, such as the ID, owner, time the event occurred, etc. A variable must be preceded by a dollar sign ($).

    VariableDescription
    $OIDName of the object to which the trigger is attached
    $OTYPEThe type of object to which the trigger is attached
    $TIMETime the trigger launched
    $HOSTLISTHostlist of the trigger's object (jobs and reservations)
    $OWNEROwner of the trigger's object (jobs and reservations)
    $USERUser (jobs and reservations)

    The variable is replaced with the information described above. For example, the following trigger is configured on all nodes:

    NODECFG[DEFAULT] EType=fail,AType=mail,Action="node $OID failed at $TIME"

    When, for example, node node03 fails, an email is sent to the primary user with a message with the subject line "node node03 started on Sat Aug 18 11:42:00".

© 2016 Adaptive Computing