Page 1 of 1

Shout to trigger on third consecutive failure of cyclic job

Posted: 02 May 2015 6:50
by AD Control-M
Hello All,

There is cyclic job which executes every day with re-run interval 30 mins.

I would like to ignore 2 failures and send ended not alert only on third failure.

ON STATEMENT *
CODE OK
DO SETVAR \FAILCNT 0
ON STATEMENT *
DO SETVER %%FAILCNT %%PLUS 1

ON FAILCNT=3
DO NOTOK

Can we achieve something like this or if anyone can suggest better way for this requirement.

Re: Shout to trigger on third consecutive failure of cyclic

Posted: 03 May 2015 10:25
by fyot
Follow this link

http://www.scheduler-usage.com/viewtopi ... ilit=third

Search third you will have several returns

Re: Shout to trigger on third consecutive failure of cyclic

Posted: 04 May 2015 9:03
by AD Control-M
hello Fyot,

Thank you for reply.

But my requirement is not runcount specific. as its cyclic job it will run throughout the day.

I want to ignore consecutive two failure, alert should not be sent to GAS only if job is failing continuously three time then it should post alert and change status to ended not ok

Re: Shout to trigger on third consecutive failure of cyclic

Posted: 08 May 2015 8:17
by Walty

Re: Shout to trigger on third consecutive failure of cyclic

Posted: 08 Jul 2015 3:26
by AD Control-M
Hi Watty,

Thanks for reply. But in the method you suggest it will still post should to GAS.

My requirement is , job should not send shout for two consecutive failures which means actually we can perform step DO OK only for first two failures and on the third consecutive failure, alert should be generated.

Re: Shout to trigger on third consecutive failure of cyclic

Posted: 28 Jul 2015 8:38
by SreeMahi
This is something tricky....

to achieve this you need a Script or Batch file which you need to invoke upon failue by sending a value as parameter.

Step 1: Set one variable called varFailedCount in server with 0
ctmvar -action set -var '%%\varFailedCount ' -varexpr "0"

Step 2: Define a script which will set the value passed by the job upon Failure
NewFailCount = $1 + 1
ctmvar -action set -var '%%\varFailedCount ' -varexpr "$NewFailCount"

Step 3: Define Shout Destination as Program and run in Server as Logical Name: VarScript and Physical Address: Script Path

Step 3: Define a shout which will trigger the script upon FAILURE
When ENDED NOTOK To: VarScript Message: %%varFC

Step 4: Set a Variable value to varFailedCount in the steps tab (v7) Or Variables section (v8)
%%varFC Value:%%varFailedCount + 1

Step 5: Set up On-Statement
On Stmt: * Code: OK
Do Shout To: VarScript Message: 0

On Stmt: * Code: varFC EQUAL 3
Do Mail: Your Mail.....

Hope this helps....