Automic Workload Automation

  • 1.  Return Status Code of 0

    Posted May 31, 2016 06:46 AM
    Hi all,
    I'm trying to write a little script that will alert me when I have Jobs which are trying to run but who's agent is down.
    I know that the status of these Jobs is "Waiting for Host". The status Code for this is 1696.

    I'm use a SQL variable that will query the AH table looking for Job with Status = '1696'
    This has worked for me in my testing so far but I'm seeing an issue today.

    I killed one of my agents, and then executed some Jobs that use this agent.
    I can see in Activities that the Jobs have Status of "Waiting for Host", but when I query the 
    AH table, the status is showing 0 for that job execution.

    Anyone out there any idea why this might be or what status of 0 means?

    Thanks,
    John.



  • 2.  Return Status Code of 0

    Posted May 31, 2016 07:25 AM
    "generate at runtime" settings?


  • 3.  Return Status Code of 0

    Posted May 31, 2016 08:00 AM
    tested with both "generate at runtime" set and unset, same result...


  • 4.  Return Status Code of 0

    Posted May 31, 2016 09:09 AM
    Hi John,

    If the job is still within the Activities window, then the Queries should be against the EH tables.  In my system, as a test I made a job get stuck on "waiting for host", when I did the following:
    select * from EH where EH_Status='1696'
    It show, only one result.

    When I try searching against the AH
    select * from AH where AH_Status='1696'
    The result come back with zero result (as the job is still within the activities window and is pending to be run, so it is expected that it is not written to the AH table yet).


  • 5.  Return Status Code of 0

    Posted May 31, 2016 09:16 AM
    Yes, I do understand this.
    I am also trying to trap "Start Impossible" Job execution errors.
    Both these category of Job execution failures are in the same bracket i.e. the Job is trying to run but cant.

    The problem with "Start Impossible"(1820) is that these Jobs fail and so don't stay in the Activities window...

    Maybe I need to rethink this and create 2 separate alerts here. 


  • 6.  Return Status Code of 0

    Posted May 31, 2016 09:39 AM

    I'm trying to write a little script that will alert me when I have Jobs which are trying to run but who's agent is down.
    I know that the status of these Jobs is "Waiting for Host". The status Code for this is 1696.

    I'm use a SQL variable that will query the AH table looking for Job with Status = '1696'

    For this first thing you are trying to do, as the "Waiting for Host" status, is not an ended status it will still be within the EH tables.

    I am also trying to trap "Start Impossible" Job execution errors.
    Both these category of Job execution failures are in the same bracket i.e. the Job is trying to run but cant.

    The problem with "Start Impossible"(1820) is that these Jobs fail and so don't stay in the Activities window...
    As for this one "FAULT_OTHER - Start impossible. Other error."  (which is 1820), as its an could not start so the job ended... and since you have it auto-deactivate/not be in the activities window (then it would only be within the AH only - If its has not been deactivated then, it could be found in both the AH/EH for "FAULT_OTHER - Start impossible. Other error.")  .

    Since you know both of that status you are looking for (1820, 1696) and "Waiting for Host" will always be in the Activities window pending that host (unless you have some other condition that end it).  For the 1820, as it is an ended status it can always be found within the AH tables.

    I recommend writting two sql, one against the EH for the 1696 and one against the AH for the 1820 (since for the 1820, it will always in the AH, while it will be in the EH -if it has not be deactivated yet).



  • 7.  Return Status Code of 0

    Posted May 31, 2016 09:44 AM
    While we are talking about EH. I've noticed that not only does it store what we see in activities but also stores a record for other tasks.

    For example, we have a number of Jobs that were at status "Waiting for Host" on our activities at the weekend. This was fine because one of the agents was down. After I brought back up the agent, the jobs ran and not longer appeared in my activities.
    However, the EH table continue to keep an entry for these tasks for a couple of days. The records did eventually disappear a couple of days later...


  • 8.  Return Status Code of 0

    Posted May 31, 2016 10:04 AM
    By way of example. If I am going to use the EH table for my query , I need to be sure it only contains active tasks.

    The screenshot below shows my activities for SOA% tasks. I don't have any filter set.

    My database query, which is looking at the EH table is showing 1 extra task, which has a timestamp of Nov 2015!
    (Query below)

    eqr0h15ksx93.png

    select distinct eh_name, eh_client, eh_status  ,  b.msg_text
    from    eh a, uc_msg b
    where a.eh_status = b.msg_id
    and eh_name like 'SOA%'
    and     B.MSG_LANG = 'E'
    and eh_client = 1
    order by 3

    This is one example of many, is there something I can add to this query to only show active tasks?


  • 9.  Return Status Code of 0

    Posted May 31, 2016 11:16 AM
    Hi John,

    This thread is starting to move away from the original questions:
    I'm trying to write a little script that will alert me when I have Jobs which are trying to run but who's agent is down.
    I know that the status of these Jobs is "Waiting for Host". The status Code for this is 1696.

    I'm use a SQL variable that will query the AH table looking for Job with Status = '1696'
    But with regarding, your latest question - If you are looking for job that have not ended/still active you could do something like this:
    Notes - This SQL is for MSSQL:

    select eh_name, EH_AH_Idnr, eh_client, eh_status, msg_text
    from EH
    inner join AH
    on EH.EH_AH_Idnr=AH.AH_Idnr
    inner join UC_MSG
    on EH.EH_Status=UC_MSG.MSG_Id
    where AH_TimeStamp4 is Null and EH_Client='100' and MSG_LANG = 'E'
    Since job that are currently still active/waiting to be run, you  could use the AH_Timestamp4  column (since this field will give the - end time (including post processing time if available), so if they have not ended yet/still active this field would be NULL.

    Please note that, if you used this for the 1820 job status, it will not show up with this SQL since Start Impossible status will have a time within the AH_Timestamp4 field.


  • 10.  Return Status Code of 0

    Posted Jun 01, 2016 10:20 AM
    great, thanks, will try that...