0

我的意图是仅在连续 x 次失败后发送失败的电子邮件通知。目前,我的 CA 自动后期处理脚本会为每个失败发送一个失败通知,但我有一个用例,只有在连续出现 3 个失败时,我们才必须发送电子邮件失败通知。

基本上我正在尝试保存最后 3 次运行信息,然后基于该使用 if 条件在连续 3 次失败后触发警报但无法这样做。

以下是我尝试过但无法正常工作的后期处理脚本(打破了我的脑袋)。

对此的任何帮助都非常感谢。

:print &usedhost#
:SET &RUNNR# = SYS_ACT_ME_NR()
:SET &STATUS# = GET_UC_OBJECT_STATUS(JOBS,&RUNNR#)
:print &STATUS#
:IF &STATUS# = '1900' or 'ENDED_OK'
:SET &STATUS# = 'ENDED_OK'
:ELSE
:SET &STATUS# = 'ENDED_NOTOK'
:SET &DUMMYSTATUS# = 'ENDED_OK'
:print "&STATUS#"
:ENDIF
:SET &CURRENTRUNSTATUS# = &CURRENTRUNSTATUS#
:SET &CURRENTRUNSTATUS1# = &CURRENTRUNSTATUS#
:SET &PREVIOUSRUNSTATUS# = &PREVIOUSRUNSTATUS#
:SET &PREVIOUSRUNSTATUS1# = &PREVIOUSRUNSTATUS#
:SET &P2PRUNSTATUS# = &P2PRUNSTATUS#
:SET &P2PRUNSTATUS1# = &P2PRUNSTATUS#
:IF &CURRENTRUNSTATUS# = ""
:SET &CURRENTRUNSTATUS# = &STATUS#
:ELSE
:SET &CURRENTRUNSTATUS# = &STATUS#
:ENDIF
:IF &PREVIOUSRUNSTATUS# = ""
:SET &PREVIOUSRUNSTATUS# = &DUMMYSTATUS#
:ELSE
:SET &PREVIOUSRUNSTATUS# = &CURRENTRUNSTATUS1#
:ENDIF
:IF &P2PRUNSTATUS# = ""
:SET &P2PRUNSTATUS# = &DUMMYSTATUS#
:ELSE
:SET &P2PRUNSTATUS# = &P2PRUNSTATUS1#
:ENDIF
:print "&CURRENTRUNSTATUS#"
:print "&PREVIOUSRUNSTATUS#"
:print "&P2PRUNSTATUS#" ```
4

1 回答 1

0

使用以下 SQL 语句创建 SQLI 变量“ANDYDROID.TEST.VARA”

--- ORACLE SQL ---
SELECT 'COUNTER', COUNT(*) COUNTER FROM
(
  SELECT * FROM (
    SELECT 
      AH_IDNR, AH_STATUS 
      FROM AH   
    WHERE 
      -- change "JOBNAME"
      AH_NAME = 'ANDYDROID.TEST.JOBS'
    ORDER BY AH_TIMESTAMP1 DESC
  )
  WHERE 
    ROWNUM <= 3
)
WHERE AH_STATUS != '1900'

在您的 POST-SCRIPT 中,从 VARA-Object 获取 COUNTER

:SET &COUNTER# = GET_VAR("ANDYDROID.TEST.VARA", "COUNTER", 2)
:IF &COUNTER# = 3
! SEND_MAIL
: SET &MAILER# = ACTIVATE_UC_OBJECT("YOUR_MAIL_JOB")
:ENDIF
于 2021-08-06T15:18:46.297 回答