Automic Workload Automation

 View Only
  • 1.  Check Job Does not Run

    Posted Aug 15, 2022 04:44 AM

    Hi All,

    Appreciate if I can get your advice, how to check job and send email to alert the job that I have scheduled to run every 5 minutes, does not run at the time scheduled.

  • 2.  RE: Check Job Does not Run

    Posted Aug 15, 2022 09:46 AM
    Are you literally kicking off this job via a schedule, or are you doing it via a period container?  (Or some other means?)

    And to be clear, you're looking for an alert to trigger when the job doesn't run at all, as opposed to when the job runs but fails?

    I think you're ultimately going to need some sort of parallel task -- perhaps a time event -- that fires every 5 minutes to verify the job in question ran.  If the job in question would log its start time to a variable, this parallel task could check to make sure the last run took place within the last 5 minutes, else alert.

  • 3.  RE: Check Job Does not Run

    Posted Aug 15, 2022 05:13 PM
    Hi Daryl,

    The job is scheduled using "execute recurring".

    Yup, I am looking for an alert to trigger when the job does not run at all.

    Thank you for your proposal on the alternative solution.

  • 4.  RE: Check Job Does not Run

    Posted Aug 16, 2022 08:55 AM

    With how frequent the job runs, you might be best suited to developing a query that pulls from the AH(I think that's the run history table) table in the Automic database.  You could then have a script parse the report or write the query return to a VARA and send an email or whatever you want it to do if the results don't match your expectations.  We have some jobs that we check up on, but they only run each day or weekly, so we just check their last run time and if it's not today's date we create an API call to ServiceNow.

    We do this also with schedule nightly reloads, since there has been schedule failures in the past.

  • 5.  RE: Check Job Does not Run
    Best Answer

    Posted Aug 16, 2022 09:28 AM
    Pete Wirf -- Miss you Pete !  Helped me set this up to check Recurring workflows several years back, when someone kept accidentally stopping the workflow when they were trying to restart it.
    You could adapt it for your purposes.

    Created 2 Vara objects -- one was a static of all the recurring workflows that ran.
    One listed all recurring workflows that were currently running.
    The Job ran every few minutes and it compared the two Vara objects and sent an email IF something wasn't running that should have been running.

    :SET &NL# = UC_CRLF()

    :SET &ALERTLIST# = ""

    ! VARA With objects to check if running












    ! Prevent handling of header .obj Name etc in &CONFIGVARA# ...

    :  IF MID(&NAME#, 1, 1)<> "."

    :    PRINT "&NAME#       Mail: &MAILADDR#"

    ! Check if the object is in EH Table

    :    SET &NAME_IN_EH# = GET_VAR(&EH_VARA#, &NAME#, 1)

    !:    SET &RUNID_IN_EH# = GET_VAR(&EH_VARA#, &NAME#, 2)

    !:    SET &STATUS_IN_EH# = GET_VAR(&EH_VARA#, &NAME#, 3)

    !:    SET &QUEUE_IN_EH# = GET_VAR(&EH_VARA#, &NAME#, 4)


    :    PRINT "EH_Name: &NAME_IN_EH#"

    !:    PRINT "EH_Status: &STATUS_IN_EH#      EH_Queue: &QUEUE_IN_EH#"

    :    PRINT "alert: &ALERT#      autostart: &AUTOSTART#"



    :    IF &NAME# <> &NAME_IN_EH#

    :      IF &ALERT# = "Y"

    :        IF &MAILADDR# = "" OR " "

    :          PRINT "&$NAME# &$RESTART_RUNID# was not able to get alert email address for &NAME#"

    :          STOP MSG, 50, "Please check &NAME# in &CONFIGVARA#"

    :        ENDIF

    :        PRINT "adding &NAME# to alertlist"

    :        IF &ALERTLIST# = ""

    :          SET &ALERTLIST# = "&NL#not active: &NAME#&NL#"

    :        ELSE

    :          SET &ALERTLIST# = "&ALERTLIST#not active: &NAME#&NL#"

    :        ENDIF

    :      ELSE

    :        PRINT "no error action necessary"

    :      ENDIF



    :      IF &AUTOSTART# = "Y"

    :        PRINT "starting object &NAME#..."


    :        IF &ACT_UC_OBJ_RUNID# = 0

    :          STOP MSG, 50, "&$NAME# &$RESTART_RUNID# was not able to start object &NAME#"

    :        ENDIF

    :      ENDIF


    :      IF "&ALERT#&AUTOSTART#" = "YY"

    :         SET &ALERTLIST# = "&ALERTLIST#&NL#&NAME# with RUNID &ACT_UC_OBJ_RUNID# restarted&NL#"

    :      ENDIF


    :    ELSE

    :      PRINT "object running, no action necessary in this case"

    :    ENDIF

    :    PRINT "==================================================="

    !         Heading will be skipped with the following else!

    :  ELSE

    :  ENDIF



    :PRINT ""

    :PRINT "-- ALERTLIST --"


    :IF &ALERTLIST# <> ""



    :  SET &RET# = SEND_MAIL("&MAILADDR#", , "ALERT - Objects not active in CLT 200", "Following objects are NOT active in &$SYSTEM# Client 200, Verify the Workflow is not active, Check for a failure in the workflow, Email OSA if Workflow is active but is showing on this report; Create a priority 2 incident to ESP Batch Scheduling if Workflow is not active and no failure &$SYSTEM# Client 200&NL#&ALERTLIST#")

    :  IF &RET# <> 0

    :    STOP MSG, 50, "&$NAME# &$RESTART_RUNID# was not able to send email RC: &RET#"

    :  ENDIF


  • 6.  RE: Check Job Does not Run

    Posted Aug 29, 2022 06:50 PM
    Thank you for sharing, Marilyn. This is very helpful.

  • 7.  RE: Check Job Does not Run

    Posted Aug 29, 2022 06:48 PM
    Thank you for sharing, Mick. This is helpful.