How to set up alert mechanisms based on the DS logs

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
pavanns
Participant
Posts: 27
Joined: Wed Sep 28, 2005 8:00 pm
Location: ca

How to set up alert mechanisms based on the DS logs

Post by pavanns »

Hi
ANy idea how do we set up alert mechanisms using DS Logs. I want to put an alert set up if i see a particular message in the Log and send out an email?

thanks
Pavan
pavan
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Re: How to set up alert mechanisms based on the DS logs

Post by sud »

You can do such kind of processing in a job sequence where through basic routines you can look for whatever message you are looking for in the job's log and send notifications.
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

There is a job in EtlStats which loops through the log file and gets row counts. You might be able to modify it to do what you want.
Mamu Kim
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

capturing part of Log masg

Post by Roopanwita »

How can I capture the status of job from job Log(basically a part of log msg like 'no of recorded inserted in table') and send it as subject of mail notification in DS sequence stage,using routine (BASIC/C code)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DataStage will never report "number of records inserted in table". DataStage reports "number of rows sent to table" - whether or not they are successfully inserted depends upon the database server. If it generates error messages, these are returned to DataStage and logged. Thus, if you want to calculate "number of records inserted" you need to do some log browsing and some arithmetic.

But, yes, it can all be done with the DataStage API functions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Re: capturing part of Log masg

Post by PhilHibbs »

Roopanwita wrote:How can I capture the status of job from job Log(basically a part of log msg like 'no of recorded inserted in table') and send it as subject of mail notification in DS sequence stage,using routine (BASIC/C code)
You are mixing terminology up, I think - job status is very different to the row count. There are DS Basic functions that return various information about a job given the name. Here is my Routine for job status:

Arguments: JobName, InfoID
$INCLUDE DSINCLUDE JOBCONTROL.H
Ans = 0
handleJob = DSAttachJob(JobName, DSJ.ERRNONE)
If NOT(handleJob) Then
Ans = -99
End
Else
Ans = DSGetJobInfo(handleJob, InfoID)
End
DetachResult = DSDetachJob(handleJob)

and my Routine for link count:

Arguments: JobName, StageName, LinkName
$INCLUDE DSINCLUDE JOBCONTROL.H
Ans = 0
handleJob = DSAttachJob(JobName, DSJ.ERRNONE)
If NOT(handleJob) Then
Ans = -99
End
Else
Ans = DSGetLinkInfo (handleJob, StageName, LinkName, DSJ.LINKROWCOUNT)
End
DetachResult = DSDetachJob(handleJob)

The Link Count routine needs to be passed the job name, and the name of an active stage and link. Active stages in a Server job would be Transformer, Sort, etc., but not Sequential File for instance. So you need to know the job design to get the row count info through this route - it doesn't use the Job Log, and you can only get info about the latest run.

InfoID can be passed such as DSJ.JOBSTATUS, DSJ.JOBSTARTTIMESTAMP, DSJ.JOBLASTTIMESTAMP, DSJ.JOBELAPSED.

I'm sure the gurus will correct me if this information is not applicable or different for PX jobs.
Phil Hibbs | Capgemini
Technical Consultant
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post by Roopanwita »

Sorry for miscommunication.
Actully i wanted to capture part of msg Log ,i'e no of records procrssed..
if there is any fatal error in job,then from Log want to capture error msg line.
Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

So you want to do in code what you do manually in Director log view?

Look at the Help for DSGetNewestLogID() and DSGetLogEvent() functions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

Roopanwita wrote:Sorry for miscommunication.
Actully i wanted to capture part of msg Log ,i'e no of records procrssed..
if there is any fatal error in job,then from Log want to capture error msg line.
Thanks
Hi,
You can also get the above result from "dsjob" commands.
For the number of records you can use :

Code: Select all

$DSHOME/bin/dsjob -report project_name job_name DETAIL
For Fatal error in the job you can use:

Code: Select all

$DSHOME/bin/dsjob -lognewest project_name job_name FATAL
:!: Store the result in the sequential file and by using "mailx" command of unix you can mail the results. :wink:
http://findingjobsindatastage.blogspot.com/
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
Post Reply