Page 1 of 1

exectime

Posted: 26 Jul 2007 5:00
by philmalmaison
does anyone had made a job scanning the AJF in cyclic mode and extracting jobs whoses execution time is > to a range time ?

Posted: 30 Jul 2007 8:43
by mauriziog
With the BIM installed and the reporting facility, is possible to generate with a job the list of the jobs that started time is more old that "a value".

Without the BIM I'm not sure that disponible templates on AJF can perform this task, but you can try.

Posted: 30 Jul 2007 3:50
by philmalmaison
what are you meaning about templates on AJF should you be a little more accurate ?

Posted: 01 Aug 2007 4:52
by zzssens
Hi have made a script that run the following query:

set pagesize 0;
set linesize 9999;
set head off;
set echo off;
set feed off;

select jobname, nodeid, applgroup, schedtab, startrun
from cmr_ajf
where state like '4' and startrun<to_char(SYSDATE-2,'yyyymmddhh24miss');

exit;

This query return the jobs in running status older than two days.

I hope this can help you

Posted: 03 Aug 2007 2:33
by philmalmaison
no my case is to create a cyclic job, able to scan ajf, select the executing jobs, and calculate if the executing job is to long or not regarding a calculation made from its average medium statistics (ctmruninf -total)

your answer concerning oracle , i'm working with sybase...

Posted: 03 Aug 2007 7:39
by philmalmaison
finally i've made somethink like that :
#!/bin/ksh
tmp="/tmp/tmp.$$"
tmp2="/tmp/ResultatExectime-`date '+%d%m%Y'`-`date '+%H%M'`.txt"
touch ${tmp2}
cd $HOME
# 1. ODATE
# 2. PREVDATE
ODATE=${1}
PREVDATE=${2}
ctmpsm -LISTALL TIME | grep "${ODATE} Executin" > ${tmp}
if [ -s ${tmp} ]
then
cat ${tmp} | while read line
do
ORDERID=`echo ${line} | awk '{print $1}'`
JOBNAME=`echo ${line} | awk '{print $2}'`
STARTRUN=`echo ${line} | awk '{print $6}'`
VALRUNH=`echo ${STARTRUN} | nawk '{print (substr($0,9,2))}'`
VALRUNM=`echo ${STARTRUN} | nawk '{print (substr($0,11,2))}'`
VALRUNS=`echo ${STARTRUN} | nawk '{print (substr($0,13,2))}'`
nbRUNH=`expr ${VALRUNH} \* 3600`
nbRUNM=`expr ${VALRUNM} \* 60`
nbSTART=`expr ${nbRUNH} + ${nbRUNM} + ${VALRUNS}`
VALDATEH=`date '+%H'`
VALDATEM=`date '+%M'`
VALDATES=`date '+%S'`
nbDATEH=`expr ${VALDATEH} \* 3600`
nbDATEM=`expr ${VALDATEM} \* 60`
nbCURRENT=`expr ${nbDATEH} + ${nbDATEM} + ${VALDATES}`
EVAL=`expr ${nbCURRENT} - ${nbSTART}`
if [ ${EVAL} -le 3600 ]
then
DUREEH=0
DUREEM=`expr ${EVAL} / 60`
DUREES=`expr ${EVAL} % 60`
else
DUREEH=`expr ${EVAL} / 3600`
a2=`expr ${EVAL} % 3600`
DUREEM=`expr ${a2} / 60`
DUREES=`expr ${a2} % 60`
fi
MOY=`ctmruninf -list ${PREVDATE}100000 ${ODATE}100000 -JOBNAME ${JOBNAME} -total | grep "Total "`
VERIF=`echo ${MOY} | awk '{print $5}'`
if [ ${VERIF} -gt 0 ]
then
TOTHITS=`echo ${MOY} | awk '{print $7}' | awk -F"." '{print $1}'`
NBREHITS=`echo ${MOY} | awk '{print $5}'`
STATSHITS=`expr ${TOTHITS} / ${NBREHITS}`
STATH=`expr ${STATSHITS} / 3600`
b1=`expr ${STATSHITS} % 3600`
STATM=`expr ${b1} / 60`
STATS=`expr ${b1} % 60`
b2=`expr ${STATSHITS} / 10`
b3=`expr ${b2} \* 5`
STATSMAX=`expr ${STATSHITS} + ${b3}`
MAXH=`expr ${STATSMAX} / 3600`
b4=`expr ${STATSMAX} % 3600`
MAXM=`expr ${b4} / 60`
MAXS=`expr ${b4} % 60`
if [ ${EVAL} -gt ${STATSMAX} ]
then
echo !!!============================================================== >> ${tmp2}
echo "JOB ${JOBNAME}" >> ${tmp2}
echo "ORDERID : ${ORDERID}" >> ${tmp2}
echo "Duree Effective : ${DUREEH}:${DUREEM}:${DUREES}" >> ${tmp2}
echo "VOIR POURQUOI" >> ${tmp2}
echo ==============================================================!!! >> ${tmp2}
fi
else
echo >> ${tmp2}
echo "JOBNAME : ${JOBNAME} ORDERID : ${ORDERID}" >> ${tmp2}
echo "Pas de Stats pour ce job" >> ${tmp2}
echo >> ${tmp2}
continue
fi
echo ---------------------------------------------------------------
echo "ORDERID : ${ORDERID}"
echo "JOBNAME : ${JOBNAME}"
echo "HEURE DEMARRAGE : ${VALRUNH}:${VALRUNM}:${VALRUNS}"
echo "HEURE COURANTE : ${VALDATEH}:${VALDATEM}:${VALDATES}"
echo "Duree Effective : ${DUREEH}:${DUREEM}:${DUREES}"
echo "Statistiques du job : ${STATH}:${STATM}:${STATS}"
echo "Statistiques Max du job : ${MAXH}:${MAXM}:${MAXS}"
echo ---------------------------------------------------------------
done
else
echo ---------------------------------------------------------------
echo "PAS DE JOBS RUNING A `date '+%H-%M-%S'`"
echo ---------------------------------------------------------------
fi
rm ${tmp}
cat ${tmp2} | mailx -s "SCAN EXECTIME > 150 % de la moyenne des stats du job" -r philippe.valette@sgam.com philippe.vale
tte@sgam.com

it's working, but just have to resolve jobs beginning before 00:00:00 and ending after by spliting calculation before after and doing the sum

:?

Posted: 07 Aug 2007 3:04
by philmalmaison
apres qqes modifs ca tourne, seul hic constat?, les jobs tres rapides sont souvent remont?s parceque le serveur controlm met du temps a mettre ses donnees a jour...

Posted: 07 Aug 2007 3:13
by philmalmaison
for the controlm job i've created a cyclic job every 30 min, with the range parameter:
PARM1=%%$ODATE
PARM2=%%$CALCDATE %%$ODATE -7
corresponding to 7 days of statistics of runinf.

Posted: 10 Aug 2007 6:26
by philmalmaison

Posted: 10 Aug 2007 6:26
by philmalmaison
Warning_Job_Long-v02.ksh

Posted: 28 Aug 2007 11:30
by mauriziog
Thanks philmalmaison,
can be usefull: very good work.

Posted: 11 Sep 2007 4:38
by philmalmaison
a new version with application and group information is avaliable same place .
:wink: