DX Infrastructure Manager

Expand all | Collapse all

Lua extensions

Jump to Best Answer
  • 1.  Lua extensions

    Posted 05-23-2018 06:12 AM

    Can someone confirm the exact format of action.email() command.
    I see it is not taking up the html template for notifying the email but some report.txt file
    and the message details also are not populating.

  • 2.  Re: Lua extensions

    Broadcom Employee
    Posted 05-23-2018 07:26 AM

    This is my script for emailing from an alarm triggered lua script

    I notice it doesn't use the html template either so I will try to investigate

    But is does produce a message contents


    a = alarm.get()

    if a ~= nil then

    otime = timestamp.format (a.nimts,"%d/%m/%Y-%H:%M:%S")

    atime = timestamp.format (a.arrival,"%d/%m/%Y-%H:%M:%S")

    recipient = "xxxxx@ca.com"

    subject = a.severity.." Alarm for host "..a.hostname.." at "..otime


    buff = "The following alarm was recieved at "..atime.." from host "..a.hostname.." originating at "..otime..".\n"

    buff = buff..a.message


         action.email (recipient,subject,buff)



  • 3.  Re: Lua extensions

    Posted 05-23-2018 08:28 AM

    Thanks for inputs Rowan,
    I figured that out and now I can see emails but as plain-text only.
    But, would definitely like to test the possibility of it using the html template. 




  • 4.  Re: Lua extensions
    Best Answer

    Posted 05-23-2018 11:13 AM

    Just force the body to be html. I use something like:


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.2.0">
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <title>Title stuff</title>

    <style type="text/css">
    td.c1 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 26px}


    this will be HTML




    And then depending on the email client, the content will be rendered appropriately.