Job email notification workaround

All questions about Control-M jobs definitions
Post Reply
User avatar
be_incontrol
Nouveau
Nouveau
Posts: 13
Joined: 26 Sep 2008 12:00

Job email notification workaround

Post by be_incontrol » 18 Aug 2012 5:33

Hello Control-M Experts,

Can someone suggest how I can create a workaround to my issue below:

1. I have a daily job (JobA) when failure occurs, I want to rerun it only 1 time.

2. JobA is set-up:
On Steps tab:
On NOTOK
Do Rerun
Do Mail (to support to fyi them that job will be rerun in next 30 minutes).

On Execution tab:
Not Cyclic
Rerun interval is 30 minutes.
Max Rerun is 1.

On PostProc tab:
When: NOTOK
To: Shout Destination table
Message: Job will be rerun in next 30 minutes

No Issue when:
JobA completes OK after rerun.

Issue is when:
JobA completes NOTOK after doing a max rerun of 1.
-Mail and Shout is sent to support and operations again with same message, however message is not true anymore due to job will not be rerun anymore.

Thank you in advance.

User avatar
brownbag
Nouveau
Nouveau
Posts: 161
Joined: 11 Oct 2007 12:00
Location: Melbourne

JOB EMAIL NOTIFICATION WORKAROUND

Post by brownbag » 16 Oct 2012 1:59

Do you want to notify the support to tell them that the job failed the second time?

User avatar
be_incontrol
Nouveau
Nouveau
Posts: 13
Joined: 26 Sep 2008 12:00

Post by be_incontrol » 16 Oct 2012 7:19

Hi brownbag,

Yes, I want to notify support that job failed again for the second (2nd) time and they need to check and investigate.

Thank you.

User avatar
brownbag
Nouveau
Nouveau
Posts: 161
Joined: 11 Oct 2007 12:00
Location: Melbourne

JOB EMAIL NOTIFICATION WORKAROUND

Post by brownbag » 16 Oct 2012 11:32

That is tough, as you want to send a different message depending on the circumstance, and both need to be sent on failure. As you, and many other Control-M users know, there are no nested IFs in the Steps panel. What I would do is take the alerting out of the job itself and instead shout to a script if the job fails (use a shout destination of type P). This script will then handle the alerts. The shout to the script must pass to the program the RUNCOUNT system parameter (and any other parameters you need for the message). The program will then check the value of this and if it is 1, it will send a message saying that the job will be rerun. If it is 2, the message will say that the job failed the second time and needs investigation. The messages can be sent using the ctmshout utility.

Scalap

Re: JOB EMAIL NOTIFICATION WORKAROUND

Post by Scalap » 05 Nov 2012 6:03

brownbag wrote:That is tough, as you want to send a different message depending on the circumstance, and both need to be sent on failure. As you, and many other Control-M users know, there are no nested IFs in the Steps panel. What I would do is take the alerting out of the job itself and instead shout to a script if the job fails (use a shout destination of type P). This script will then handle the alerts. The shout to the script must pass to the program the RUNCOUNT system parameter (and any other parameters you need for the message). The program will then check the value of this and if it is 1, it will send a message saying that the job will be rerun. If it is 2, the message will say that the job failed the second time and needs investigation. The messages can be sent using the ctmshout utility.
Hello,

that's seems to be a good way.
Have you got an example of this kind of script (call by shout and check RunCount before send a different alarm by mail) ?

Thanks a lot if you can.

User avatar
brownbag
Nouveau
Nouveau
Posts: 161
Joined: 11 Oct 2007 12:00
Location: Melbourne

JOB EMAIL NOTIFICATION WORKAROUND

Post by brownbag » 06 Nov 2012 10:20

Hi,
I don't have any example of such a script - I'm no scripting expert and it does depend on the platform.
But basically it is is an IF/ELSE statement, something like this:
IF $RUNCOUNT = 1 THEN
ctmshout -DEST CTMSUPPORT -MESSAGE "Job failed. It will be rerun"
ELSE
ctmshout -DEST CTMSUPPORT -MESSAGE "Job failed twice. Please investigate"
ENDIF

Post Reply