Академический Документы
Профессиональный Документы
Культура Документы
# Title
: This is a weekly script which is used to report OM WOW and D
M WOW metrics fall out of range (+20 or -20)
# Filename
: dw_cmc.dw_ecare_rmscard_metrics_range.ksh
# Description : This shell will generate a HTML mail with the contents of th
e input DAT file
# Developer
: Cognizant Team
# Created on
: 03/11/2007
# Location
: $DW_EXE/
# Called By
: UC4
# Calls
:
# Date
Version
Modified By (Name)
Change and Reason for change
#-----------------------------------------------------------------------------# 03/11/2007
1
Cognizant Team
Initial Version
#******************************************************************************/
. /export/home/abinitio/cfg/abinitio.setup
time=`date '+%Y%m%d_%T'`
scriptName=`basename $0`
script=${scriptName%".ksh"}
export SUBJECT_AREA=${ETL_ID%%.*}
export TABLE_ID=${ETL_ID##*.}
#---------------------------# Declaring the Local variables
#---------------------------#MAILING_LIST=vbalasubrama@ebay.com,jgurusamy@ebay.com
MAILING_LIST=DL-eBay-RM-Scorecard-Alert@ebay.com
METRICS_RANGE_FILE=${DW_TMP}/${JOB_ENV}/${SUBJECT_AREA}/dw_cmc.dw_ecare_rmscard_
metrics_range_fail.dat
METRICS_RANGE_FILE_TMP=${DW_TMP}/${JOB_ENV}/${SUBJECT_AREA}/dw_cmc.dw_ecare_rmsc
ard_metrics_range_temp.dat
HTML_EMAIL=${DW_TMP}/${JOB_ENV}/${SUBJECT_AREA}/dw_cmc.dw_ecare_rmscard_metrics_
range_html_mail.dat
LOG_FILE=${DW_LOG}/${JOB_ENV}/${SUBJECT_AREA}/${script}.${time}.log
#-----------------------------------------#Check if the input data file exists or not
#-----------------------------------------if [ ! -e $METRICS_RANGE_FILE ]
then
echo "Error: Input data file $METRICS_RANGE_FILE not available" >> $LOG_FILE
exit 1
fi
#---------------------------------------------# If the DAT file has no records
#---------------------------------------------line_count=`cat $METRICS_RANGE_FILE | wc -l`
if [ ${line_count} -le 1 ]
then
echo "Error: No data to process in the formatted input file $METRICS_RAN
GE_FILE" >> $LOG_FILE
echo "Mail sent successfully to all users in the mailing list" >> $LOG_F
ILE
echo "ALL OM/DM METRICS ARE BOUND TO LOWER LIMIT(-20) AND UPPER LIMIT(+2
0)" > $HTML_EMAIL
cat $HTML_EMAIL | /usr/lib/sendmail "${MAILING_LIST}"
#Cleanup
rm -f $METRICS_RANGE_FILE
rm -f $HTML_EMAIL
exit 0
fi
#-----------------------------------------------------------------------# Formating the dat file(Adding Zero to the decimal part of metrics columns)
#-----------------------------------------------------------------------sed "s/|\./|0./g" $METRICS_RANGE_FILE > $METRICS_RANGE_FILE_TMP
mv $METRICS_RANGE_FILE_TMP $METRICS_RANGE_FILE
#-----------------------#Prepare the HTML tags
#-----------------------echo "content-type: text/html
From:
To: ${MAILING_DL}
Subject: Alert: OM/DM Metrics out of range" > $HTML_EMAIL
first_row=0
echo "<table border=1 cellspacing=1 cellpadding=1><font size=1 face=Arial>" >> $
HTML_EMAIL
while read record
do
echo "$record"
echo "$record"
echo "$record"
echo "$record"
echo "$record"
|
|
|
|
|
awk
awk
awk
awk
awk
-F"|"
-F"|"
-F"|"
-F"|"
-F"|"
'{print
'{print
'{print
'{print
'{print
$1}'
$2}'
$3}'
$4}'
$5}'
|
|
|
|
|
read
read
read
read
read
col1
col2
col3
col4
col5