Automic Workload Automation

 View Only
Expand all | Collapse all

Agent not set

  • 1.  Agent not set

    Posted Nov 05, 2019 03:28 PM
      |   view attached
    Dear guys, 

    I have this script that I put in the Job's Post Process.

    The purpose of this script is to scan through the output file for a specific string.

    In order to do that, I need to set the Agent, and somehow the agent was not able to be set, most properly was used by another job. Because of this, the script didn't work (Depends on whether the script managed to set the agent or not, sometimes it works, sometimes it is not).

    Will you please suggest if there is any way I can improve this script? For example like if the agent is not set, then it will not proceed to the next, but at the same time not creating an infinitely loop.

    Attached is the portion of the script that trying to set the agent, please let me know if you need more information.

    Any help is appreciated. :)


    ------------------------------
    Ken
    TX, Houston
    ------------------------------


  • 2.  RE: Agent not set

    Posted Nov 06, 2019 01:51 AM
    Hi Ken,

    if you are in the Post-Script of a job you can use the predefined variable &$AGENT#. I would first check for the status / return code of the job and then the check the file.
    For example (without guarantee):

    :IF GET_UC_OBJECT_STATUS( ,,"RETCODE") = "0"
    :SET &HND# = PREP_PROCESS_FILE("&$AGENT#", "&FILE_NAME#", "*&SEARCH..." ...
    :PROCESS &HND#
    [...]
    :CLOSE_PROCESS &HND#
    :ENDIF

    Kind regards,
    Tim

    ------------------------------
    Automation Evangelist
    Fiducia & GAD IT AG
    ---
    Mitglied des deutschsprachigen Automic-Anwendervereins FOKUS e.V.
    Member of the German speaking Automic user association FOKUS e.V.
    ------------------------------



  • 3.  RE: Agent not set

    Posted Nov 06, 2019 06:25 PM
    Dear Tim,

    Thank you! I tried and I still have the same issue, not able to set the agent. I wonder if there is anyway we can keep checking the Agent status until we confirm it is OK then we can set it without creating an infinity loop?

    Any advice is appreciated. Thank you!

    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 4.  RE: Agent not set

    Posted Nov 08, 2019 12:57 AM

    Hello, Ken,

    I'm afraid I don't quite understand your problem.

    You have a Unix job running on an agent of a host group. After the job has run, you want to search the output file for a string.
    Is that correct?

    If yes: Normally there are only (milli) seconds between the execution of the job on the Unix system and the post script. It is extremely unlikely that the agent will fail during this time. So I would like to replace the section "! Resolve agent group" simply by the line
    :SET &SCAN_AGENT# = &$AGENT#

    Kind regards,
    Tim



    ------------------------------
    Automation Evangelist
    Fiducia & GAD IT AG
    ---
    Mitglied des deutschsprachigen Automic-Anwendervereins FOKUS e.V.
    Member of the German speaking Automic user association FOKUS e.V.
    ------------------------------



  • 5.  RE: Agent not set

    Posted Nov 08, 2019 01:49 AM
    Hi

    Fully agree with Tim.
    This will definitely work in 99,9% of all cases.

    If you want to be 100% sure, you can use code snippet:

    !Checks if the agent is online
    :IF SYS_HOST_ALIVE(&$AGENT#)= "N"
    !Here goes your PREP_PROCESS_AGENTGROUP snippet
    :ENDIF


    cheers, Wolfgang

    ------------------------------
    Support Info:
    if you are using one of the latest version of UC4 / AWA / One Automation please get in contact with Support to open a ticket.
    Otherwise update/upgrade your system and check if the problem still exists.
    ------------------------------



  • 6.  RE: Agent not set

    Posted Nov 08, 2019 09:57 AM
    Dear Tim, 

    Sorry that my explanation confused you. The job is created for Oracle E-Business Suit concurrent job. And the Oracle is sit in the Linux system.

    And yes, I will try your code and see if it solves the issue.

    Thank you so much for your help! :)


    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 7.  RE: Agent not set

    Posted Nov 06, 2019 02:59 AM
    Is &SCAN_AGENT# an OS agent always? PREP_PROCESS_FILE works for OS Agents only.

    What about Agent LOG file? Are there any errors or warnings?


  • 8.  RE: Agent not set

    Posted Nov 06, 2019 04:57 PM
    Hi Dejan, not sure if I understand you correctly, but the agent that I have been using is for LINUX. :)

    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 9.  RE: Agent not set

    Posted Nov 07, 2019 03:09 AM
    Hi

    can you pls post the complete Postscript?
    especially what do you process (above line 14) to get the agent's name?

    Which err message appears if it does not work?

    KR Wolfgang

    ------------------------------
    Support Info:
    if you are using one of the latest version of UC4 / AWA / One Automation please get in contact with Support to open a ticket.
    Otherwise update/upgrade your system and check if the problem still exists.
    ------------------------------



  • 10.  RE: Agent not set

    Posted Nov 07, 2019 11:16 AM
      |   view attached
    Dear Wofgang,

    Attached is the full script. 

    As you can see, I first set the agent, then check the agent is = "" or not, if it is empty, then I set again. (Technically I set the agent twice if it is empty).

    After that, before I search the string, I check the agent again, and when it is still empty, then I will print the message "No agent selected to be used for scan".

    We are running this for the Oracle E-Business suite batch job, which means that many different OUs are running the job together but different OU.

    Please let me know if you need more information, any advice is appreciated. Thank you! :)





    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 11.  RE: Agent not set
    Best Answer

    Posted Nov 08, 2019 05:38 AM

    Please add this into your Job's Post Process, execute it and share the POST report!

    :SET &HND# = PREP_PROCESS_HOSTGROUP ("HOSTG.LINUX",,,)
    
    :PROCESS &HND#
    :   SET &AGENT# = GET_PROCESS_LINE(&HND#,1)
    :   SET &STATUS# = GET_PROCESS_LINE(&HND#,2)
    :   PRINT "Agent=&AGENT#"
    :   PRINT "Status=&STATUS#"
    :ENDPROCESS
    
    :CLOSE_PROCESS &HND# ​



  • 12.  RE: Agent not set

    Posted Nov 12, 2019 05:38 PM
    Edited by Ken Yong Nov 12, 2019 06:16 PM
    Dear Dejan,

    I will try on this code and get back to you, thank you! :)

    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 13.  RE: Agent not set

    Posted Nov 13, 2019 03:20 AM
    Hi Ken,

    please reply in the thread.

    You wrote "This code cannot work. I got error when the Post Process comes to this script, the POST report wasn't generated too."

    The code I provided is your own code. The only one difference is that you filter on &TARGET_AGENT#.
    I just wanted to see all agents in your host group HOSTG.LINUX

    If you don't get this running, then just run the job with your own code and share the ACT report, generated by your code, where the agent is not set.