Automic Workload Automation

Expand all | Collapse all

Host Group Mode all setup in an include.

  • 1.  Host Group Mode all setup in an include.

    Posted Oct 17, 2016 04:52 PM
    Hi,
      We're beginning to implement host groups and don't want to hardcode the host in the Attributes tab.

      We've successfully implmented this code via an include preprocess statement when the agentgroup mode is FIRST.

    :SET &HND# = PREP_PROCESS_AGENTGROUP ("INV.HOST_GROUP.CRIMS",,"BY_RULE")
    :  PROCESS &HND#
    :    SET &HOST# = GET_PROCESS_LINE(&HND#,1)
    :    SET &STATUS# = GET_PROCESS_LINE(&HND#,2)
    :    PRINT "Host: &HOST#"
    :    PRINT "Status: &STATUS#"
    :  IF &STATUS# = "Y"
    :   TERM_PROCESS
    :  ENDIF
    :  ENDPROCESS
    :CLOSE_PROCESS &HND#
    :PUT_ATT HOST = &HOST#

    But when the mode is ALL, the host assignement only occurs on the last server in the group.  Any help is apprecaited.


  • 2.  Host Group Mode all setup in an include.

    Posted Oct 21, 2016 12:47 PM
    Hi,

    From your script --- it will go through the Process (at the end of the process, &HOST# = last agent in the group). Once :PROCESS is done, it will then assign the attribute HOST with &HOST#. 
    In Statistics, you will see that the job was run against &HOST#, once.

    Even if you place PUT_ATT HOST = &HOST# inside :PROCESS, the result will be the same. Because the job is activated once and it will run against the last agent found in the group.

    If you want a job to run against all the agents found in the group:
    1) without assigning the HostGroup (mode=ALL) in the Attributes tab
    2) and using PREP_PROCESS_AGENTGROUP
    Then you will need to activate the job for each agent it will run against.

    Example (Note that there are other ways to do this, this is just one example):

    1) create a SCRI that will activate your job (eg: SCRI.TRIGGER)
    :SET &HND# = PREP_PROCESS_AGENTGROUP("HOSTG.CCH.WIN",,ALL)

    :PROCESS &HND#
    : PSET &AGENT# = GET_PROCESS_LINE(&HND#,1)
    : SET &STATUS# = GET_PROCESS_LINE(&HND#,2)
    : PRINT "Agent: &AGENT#"
    : PRINT "Status: &STATUS#"
    : IF &STATUS# = "Y"
    :SET &ACT# = activate_uc_object(JOBS.WIN.CCH.HOSTG,,,,,PASS_VALUES)
    : ENDIF
    :ENDPROCESS


    2) In Pre-Process tab of the job JOBS.WIN.CCH.HOSTG, assign a value to attribute HOST (from SCRI.TRIGGER)
    :PUT_ATT HOST = &AGENT#

    You may also want to check out the link below. The list of agents is in a VARA object and retrieved by a key. You can loop through the the VARA result as well and activate a job for each agent found.

    https://community.automic.com/discussion/7404/u00020554-data-sequence-couldnt-be-written-into-a-file-agent-hostg-***-isnt-active-at-the-moment  


  • 3.  Host Group Mode all setup in an include.
    Best Answer

    Posted Nov 18, 2016 03:16 PM
    Perfect --- Thanks!