Automic Workload Automation

 View Only

Expand all | Collapse all

I want to send mail alert to the outside of Domain in the script object

  • 1.  I want to send mail alert to the outside of Domain in the script object

    Posted Oct 22, 2024 09:19 AM

    Hello All, i am working on a use case where i want to check the agent status and send mail if agent status gets changed either it is Y to N or N to Y.

    I am getting mail which i.e in the same domain, below script also working fine. But i want to send mail outside of domain, is that posible? if possible, please suggest me.

    :SET &CURRENT_STATUS# = SYS_HOST_ALIVE("REST01")
    :PUT_VAR "VARA.AGENT_CURSTATUS", "REST01", &CURRENT_STATUS#
    :SET &PREVIOUS_STATUS# = GET_VAR("VARA.AGENT_PRESTATUS", "REST01")
    :IF &CURRENT_STATUS# <> &PREVIOUS_STATUS#
    :   IF &CURRENT_STATUS# = "N"
    :      SET &EMAIL_TO# = "Automic@m***lab.com"
    :      SET &SEND_EMAIL# = SEND_MAIL("Automic@m***lab.com", &EMAIL_TO#, "Agent REST01 Alert", "The Agent REST01 is not active! Please check the system.",,,,'192.168.10.1*')
    :      PRINT "Email notification sent for inactive agent REST01."
    :   ELSE
    :      PRINT "Agent REST01 is  active."
    :      SET &EMAIL_TO# = "Automic@m***lab.com"
    :      SET &SEND_EMAIL# = SEND_MAIL("Automic@m***lab.com", &EMAIL_TO#, "Agent REST01 Alert", "The Agent REST01 status changed its started now! ",,,,'192.168.10.1*')
    :      PRINT "Agent REST01 is Running"
    :   ENDIF
    :ENDIF
     
    :PUT_VAR "VARA.AGENT_PRESTATUS", "REST01", &CURRENT_STATUS#

    Regards,

    Kiran Kumar Vasanthavada.



  • 2.  RE: I want to send mail alert to the outside of Domain in the script object

    Posted Oct 22, 2024 10:07 AM

    Yes, you can use SEND_MAIL with whatever email address you like...but whether it gets delivered is likely more a function of the mail relay server Automic is configured to send those emails to.  I.e., it's entirely possible the mail relay server could be configured to block external email addresses; that'd be a question for your mail server admin.

    Are you getting errors trying to send emails to external parties, or haven't you tried doing so yet?

    On a side note, are you familiar with the UC_HOSTCHAR_DEFAULT's EXECUTE_ON_END / EXECUTE_ON_LOST / EXECUTE_ON_START fields?  You can configure an object to be automatically invoked whenever an agent goes up or down.  Might be easier than having your special object here to track the current and previous status of a particular agent.