monitor.sh
#!bin/bash message_counts=""
succeed_counts=""
all_succeed_counts=""
fail_counts=""
all_fail_counts="" #获取昨天的日期
# Set the current month day and year.
month=`date +%m`
day=`date +%d`
year=`date +%Y` # Add 0 to month. This is a
# trick to make month an unpadded integer.
month=`expr $month + 0` # Subtract one from the current day.
day=`expr $day - 1` # If the day is 0 then determine the last
# day of the previous month.
if [ $day -eq 0 ]; then
# Find the preivous month.
month=`expr $month - 1`
# If the month is 0 then it is Dec 31 of
# the previous year.
if [ $month -eq 0 ]; then
month=12
day=31
year=`expr $year - 1`
# If the month is not zero we need to find
# the last day of the month.
else
case $month in
1|3|5|7|8|10|12) day=31;;
4|6|9|11) day=30;;
2)
if ( [ `expr $year % 4` -eq 0 ] && [ `expr $year % 100` -ne 0 ] || [ `expr $year % 400` -eq 0 ] ) ; then
day=29
else
day=28
fi
;;
esac
fi
fi case $day
in 1|2|3|4|5|6|7|8|9) day='0'$day
esac
case $month
in 1|2|3|4|5|6|7|8|9) month='0'$month
esac
#echo $year$month$day
system_date=$year$month$day
#################################################################################
#Judging the type of the system
echo "Judging the type of the system"
hostname | grep HVPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="HVPS"
fi
#################################################################################
hostname | grep SAPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="SAPS"
fi
#################################################################################
hostname | grep NETS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="NETS"
fi
#################################################################################
hostname | grep BEPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="BEPS"
fi
#################################################################################
hostname | grep IBPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="IBPS"
fi
#################################################################################
hostname | grep SCPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="SCPS"
fi
#################################################################################
hostname | grep PMTS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="PMTS"
fi
#################################################################################
hostname | grep FXCC > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="FXCC"
fi
#################################################################################
hostname | grep CIPS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="CIPS"
fi
#################################################################################
hostname | grep IMGS > /dev/null 2>&1
system_tag=`echo $?`
if [[ $system_tag = 0 ]];;then
system_type="IMGS"
fi
#################################################################################
echo "This is $system_type"
sytem_type_Lowercase=`echo $system_type`
typeset -l sytem_type_Lowercase
#################################################################################
#################################################################################
#HVPS SAPS NETS BEPS IBPS
#################################################################################
if [ $system_type = "HVPS" ] || [ $system_type = "SAPS" ] || [ $system_type = "NETS" ] || [ $system_type = "BEPS" ] || [ $system_type = "IBPS" ];then
now_dir=`pwd`
mkdir -p $now_dir"/"monitor"/"$system_type
work_dir=$now_dir"/"monitor"/"$system_type
#collecting corefile documents
#collecting dumps documents
rm -rf $work_dir/core_file_list $work_dir/dump_file_list.log
cd /corefiles
ls -lrt core* >> $work_dir/core_file_list
echo "Collecting dumps documents"
dump_file_dir=`df -g | grep "/dumps/dir1" | awk '{print $7}'`
cd $dump_file_dir
ls -lrt ShowProcInfoDump* >> $work_dir/dump_file_list.log
#################################################################################
#################################################################################
#collecting and analysising message documents
echo "collecting and analysising message documents"
if [ $1 = "-c" ]
then
Global_all=0
Global_success=0
Global_failed=0
rm -f $work_dir/fail_message$system_date.log
cat $2 | while read line
do
LINE=`echo $line | awk -F"/" '{ print $5}'`
seq=`echo $line | awk -F"/" '{ print $6}'`
if [ $LINE != $LINEEE ]
then
echo "============================================================================================" >> $work_dir/Glo.log
echo "cnaps2/"$sytem_type_Lowercase"/log/"$LINEEE >> $work_dir/Glo.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo.log
echo "============================================================================================" >> $work_dir/Glo.log
Global_all=0
Global_success=0
Global_failed=0
fi
cd $line
for seq1 in `ls -rt $system_type* | grep -v *lck`
do
mkdir -p $work_dir"/failed_message/"$LINE"/"$seq
mkdir -p $work_dir"/all_message/"$LINE"/"$seq
failelmessage_dir=$work_dir"/failed_message/"$LINE"/"$seq
allmessage_dir=$work_dir"/all_message/"$LINE"/"$seq
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1" is analyzing!"
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $allmessage_dir/$seq1.log
cat $seq1 | awk '/^\[201/||/^\*\*/{print $0 "'"$zzz"'" "/" "'"$seq"'" "/" "'"$seq1"'"}' >> $allmessage_dir/$seq1.log
#############################
perl -e 'print reverse <>' $allmessage_dir/$seq1.log >> $work_dir/template1.log
sed '/CU1I0000/{N;d; }' $work_dir/template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template2.log
perl -e 'print reverse <>' $work_dir/template2.log >> $filelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
sum_all_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | grep "CU1I0000" | wc -l`
sum_fail_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | grep -v "CU1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $failelmessage_dir/$seq1.log
echo "messages of /cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1" are calculatting"
echo "sum_all_temp messages have been sent ,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq1.log
#######################
#######################
echo "#########################################################################" >> $work_dir/Glo.log
echo "#########################################################################" >> $work_dir/Glo.log
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $work_dir/Glo.log
echo "$sum_all_temp messages have been sent, among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo.log
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template1.log
rm -rf $work_dir/template2.log
done
LINEEE=`echo $LINE`
done
echo "Collecting and Analysising console* documents"
console_dir=`df -g | grep "cics_regions" | awk '{ print $7 }' | grep $system_type | grep -v "dumps"`
cd $console_dir
for ii in `ls -rt | grep "console*" | grep -v "nam" | grep -v "msg"`
do
echo $console_dir"/"$ii" is analyzing!"
cat $ii | awk '/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]E/||/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]W/{print $0 "-----------" "'"$console_dir"'" "/" "'"$ii"'"}' >> $work_dir/console_error.log
done
console_counts=`cat $work_dir/console_error.log | grep "^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]" | wc -l`
echo "==============================================================================================" >> $work_dir/console_error.log
echo "there are $console_counts error messages" >> $work_dir/console_error.log
else
if [ $# = 0 ];then
cd /cnaps2/$system_type_Lowercase/log
rm -rf $work_dir/fail_message$system_date.log
find /cnaps2/$system_type_Lowercase/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d | awk -F"/" '{ print $5 }' | uniq >> $work_dir/type_list.log
########
########
########
for LINE in `cat $work_dir/type_list.log`
do
Global_all=0
Global_success=0
Global_failed=0
cd /cnaps2/$system_type_Lowercase/log/$LINE
zzz="/cnaps2/$system_type_Lowercase/log/$LINE"
for seq in `ls | grep "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"`
do
cd /cnaps2/$system_type_Lowercase/log/$LINE/$seq
for seq1 in `ls -rt $system_type* | grep -v *lck`
do
mkdir -p $work_dir"/failed_message/"$LINE"/"$seq
mkdir -p $work_dir"/all_message/"$LINE"/"$seq
failelmessage_dir=$work_dir"/failed_message/"$LINE"/"$seq
allmessage_dir=$work_dir"/all_message/"$LINE"/"$seq
echo "/cnaps2/"$system_type_Lowercase"/log/"$LINE/$seq"/"$seq1" is analyzing!"
echo "/cnaps2/"$system_type_Lowercase"/log/"$LINE/$seq"/"$seq1 >> $allmessage_dir/$seq1.log
cat $seq1 | awk '/^\[201/||/^\*\*/{print $0 "'"$zzz"'" "/" "'"$seq"'" "/" "'"$seq1"'"}' >> $allmessage_dir/$seq1.log
#########################################################################################################
perl -e 'print reverse <>' $allmessage_dir/$seq1.log >> $work_dir/template1.log
sed '/CU1I0000/{N;d; }' $work_dir/template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template2.log
perl -e 'print reverse <>' $work_dir/template2.log >> $filelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
sum_all_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | grep "CU1I0000" | wc -l`
sum_fail_temp=`cat $allmessage_dir/$seq1.log | grep "^\*\*" | grep $seq1 | grep -v "CU1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "**************************************************************" >> $failelmessage_dir/$seq1.log
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $failelmessage_dir/$seq1.log
echo "messages of /cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1" are calculatting"
echo "sum_all_temp messages have been sent ,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq1.log
#######################
#######################
echo "#########################################################################" >> $work_dir/Glo_$1_$2.log
echo "#########################################################################" >> $work_dir/Glo_$1_$2.log
echo "/cnaps2/"$sytem_type_Lowercase"/log/"$LINE"/"$seq"/"$seq1 >> $work_dir/Glo_$1_$2.log
echo "$sum_all_temp messages have been sent, among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo_$1_$2.log
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template1.log
rm -rf $work_dir/template2.log
done
done
echo "============================================================================================" >> $work_dir/Glo_$1_$2.log
echo "cnaps2/"$sytem_type_Lowercase"/log/"$LINEEE >> $work_dir/Glo_$1_$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1_$2.log
echo "============================================================================================" >> $work_dir/Glo_$1_$2.log
done
rm -rf $work_dir/type_list.log
###########################################################################################################
###########################################################################################################
echo "Collecting and Analysising console* documents"
console_dir=`df -g | grep "cics_regions" | awk '{ print $7 }' | grep $system_type | grep -v "dumps"`
cd $console_dir
for ii in `ls -rt | grep "console*" | grep -v "nam" | grep -v "msg"`
do
echo $console_dir"/"$ii" is analyzing!"
cat $ii | awk '/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]E/||/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]W/{print $0 "-----------" "'"$console_dir"'" "/" "'"$ii"'"}' >> $work_dir/console_error.log
done
console_counts=`cat $work_dir/console_error.log | grep "^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]" | wc -l`
echo "==============================================================================================" >> $work_dir/console_error.log
echo "there are $console_counts error messages" >> $work_dir/console_error.log
fi
#####################################################################################################
#####################################################################################################
#####################################################################################################
if [ $# = 2 ];then
mkdir $work/ssss
time_year_s=`echo $1 | cut -c 1-4`
time_year_ss=`echo $1 | cut -c 3-4`
time_month_s=`echo $1 | cut -c 5-6`
time_day_s=`echo $1 | cut -c 7-8`
time_hour_s=`echo $1 | cut -c 9-10`
time_minute_s=`echo $1 | cut 11-12`
time_second_s=`echo $1 | cut 13-14`
##################################
time_year_e=`echo $2 | cut -c 1-4`
time_year_ee=`echo $2 | cut -c 3-4`
time_month_e=`echo $2 | cut -c 5-6`
time_day_e=`echo $2 | cut -c 7-8`
time_hour_e=`echo $2 | cut -c 9-10`
time_minute_e=`echo $2 | cut 11-12`
time_second_e=`echo $2 | cut 13-14`
##################################
serch_tag_s=`echo $1 | cut -c 1-8`
serch_tag_e=`echo $2 | cut -c 1-8`
##############
##############
##################################
find /cnaps2/$system_type_Lowercase/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d | awk -F"/" '{ print $5 }' | uniq >> $work_dir/documents_name.log
cat $work_dir/documents_name.log | while read LINE
do
find /cnaps2/$system_type_Lowercase/log/$LINE -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/ssss/zzzz.log ##########################################################################################################################
##########################################################################################################################
##########################################################################################################################
cat $work_dir/ssss/zzzz.log | awk -F"/" '{print $NF}' >> $work_dir/ssss/zzzz1.log
cat $work_dir/ssss/zzzz1.log | while read ZZZZ
do
if [ "$ZZZZ" -ge "$serch_tag_s"] && [ "$ZZZZ" -le "$serch_tag_e" ];then
cat $work_dir/ssss/zzzz.log | grep $ZZZZ >> $work_dir/ssss/$LINE
fi
done
##########################################################################################################################
##########################################################################################################################
##########################################################################################################################
rm -rf $work_dir/ssss/zzzz1.log
rm -rf $work_dir/ssss/zzzz.log
done
for i in `ls -rt $work_dir/ssss/`
do
echo $work_dir/ssss/$i >> $work_dir/need_to_analysis_list.log
done
################################################
log_serch_tag_s=$time_year_s"-"$time_month_s"-"$time_day_s" "$time_hour_s":"$time_minute_s
log_serch_tag_e=$time_year_e"-"$time_month_e"-"$time_day_e" "$time_hour_e":"$time_minute_e
echo $log_serch_tag_s
echo $log_serch_tag_e
################################################
cat $work_dir/need_to_analysis_list.log | while read LINE
do
Global_all=0
Global_success=0
Global_failed=0 cat $LINE | while read date_dir
do
zzz=`echo $date_dir | awk -F"/" '{ print $5 "/" $6 }'`
############
cat $date_dir
for seq2 in `ls -rt $system_type* | grep -v *lck`
do
#########
mkdir -p $work_dir"/failed_message/"$zzz
mkdir -p $work_dir"/all_message/"$zzz
failelmessage_dir=$work_dir"/failed_message/"$zzz
allmessage_dir=$work_dir"/all_message/"$zzz
echo $date_dir"/"$seq2" is analyzing!"
echo $date_dir"/"$seq2 >> $allmessage_dir/$seq2.log
cat $seq2 | awk '/^\[201/||/^\*\*/{print $0 "'"$date_dir"'" "/" "'"$seq2"'"}' >> $work_dir/template.log
cat $work_dir/template.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0}}' >> $allmessage_dir/$seq2.log
rm -rf $work_dir/template.log
##############################################################################
##############################################################################
##############################################################################
perl -e 'print reverse <>' $allmessage_dir/$seq2.log >> $work_dir/template1.log
sed '/CU1I0000/{N;d; }' $work_dir/template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template2.log
perl -e 'print reverse <>' $work_dir/template2.log >> $filelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
sum_all_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $seq2 | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $seq2 | grep "CU1I0000" | wc -l`
sum_fail_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $seq2 | grep -v "CU1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo $date_dir"/"$seq2 >> $failelmessage_dir/$seq2.log
echo "messages of "$date_dir"/"$seq2" are calculatting"
echo "sum_all_temp messages have been sent ,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq2.log
#######################
echo "#########################################################################" >> $work_dir/Glo_$1_$2.log
echo "#########################################################################" >> $work_dir/Glo_$1_$2.log
echo $date_dir"/"$seq2 >> $work_dir/Glo_$1_$2.log
echo "$sum_all_temp messages have been sent, among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo_$1_$2.log
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template1.log
rm -rf $work_dir/template2.log
done
done
echo "============================================================================================" >> $work_dir/Glo_$1_$2.log
echo "cnaps2/"$sytem_type_Lowercase"/log/"$zzz >> $work_dir/Glo_$1_$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1_$2.log
echo "============================================================================================" >> $work_dir/Glo_$1_$2.log
done
rm -rf $work_dir/ssss
rm -rf $work_dir/documents_name.log
rm -rf $work_dir/need_to_analysis_list.log
##################################
##################################
##################################
echo "Collecting and Analysising console* documents"
log_serch_tag_s=$time_year_ss"-"$time_month_s"-"$time_day_s""$time_hour_s":"$time_minute_s":"$time_second_s
log_serch_tag_e=$time_year_ee"-"$time_month_e"-"$time_day_e""$time_hour_e":"$time_minute_e":"$time_second_e
echo $log_serch_tag_s
echo $log_serch_tag_s
console_dir=`df -g | grep "cics_regions" | awk '{ print $7 }' | grep $system_type | grep -v "dumps"`
cd $console_dir
for ii in `ls -rt | grep "console*" | grep -v "nam" | grep -v "msg"`
do
echo $console_dir"/"$ii" is analyzing!"
cat $ii | awk '/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]E/||/^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]W/{print $0 "-----------" "'"$console_dir"'" "/" "'"$ii"'"}' >> $work_dir/console_error.log done $work_dir/temp.log | awk -F'[\ \\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0}}' >> $work_dir/console_error.log
cat
console_counts=`cat $work_dir/console_error.log | grep "^ERZ[0-9][0-9][0-9][0-9][0-9][0-9]" | wc -l`
echo "==============================================================================================" >> $work_dir/console_error.log
echo "there are $console_counts error messages" >> $work_dir/console_error.log
fi
fi #Quering queue
echo "Quering queue now (ERRMSG DEADQ)"
rf -rf $work_dir/queue_ERRMSG.log $work_dir/queue_DEADQ.log
qmName=`dspmq | grep $system_type | awk '{print $1}' | sed -e 's/^QMNAME(//;s/)//'`
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqERRMSG >> queue_ERRMSG.log && exit"
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqDEADQ >> queue_DEADQ.log && exit"
cp /cnaps2/$system_type_Lowercase/queue_ERRMSG.log $work_dir/queue_ERRMSG.log
cp /cnaps2/$system_type_Lowercase/queue_DEADQ.log $work_dir/queue_DEADQ.log
rm -rf /cnaps2/$system_type_Lowercase/queue_ERRMSG.log /cnaps2/$system_type_Lowercase/queue_DEADQ.log
fi ########################################################################################
#PMTS
########################################################################################
if [[ $1 = "PMTS" ]];then
now_dir=`pwd`
mkdir -p $now_dir"/"monitor"/"$system_type
work_dir=$now_dir"/"monitor"/"$system_type
rm -rf $work_dir/successed.log
rm -rf $work_dir/failed.log
date_tag=$year"-"$month"-"$day
########################################################################################
########################################################################################
########################################################################################
#collecting and analysising message documents
echo "collecting and analysising message documents"
if [ $# = 0 ];then
touch $work_dir/successed_tmp.log
touch $work_dir/failed_tmp.log find /cnaps2/$system_type_Lowercase/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_list.log
######################################################################################## ########################################################################################
for seq in `cat $work_dir/documents_list.log`
do
Global_all=0
up_Global_success=0
Global_failed=0
date_dir=`echo $seq | awk -F"/" '{ print $NF }'`
mkdir -p $work_dir"/success_message/"$date_dir
success_message_dir=$work_dir"/success_message/"$date_dir
cd $seq/msg
for seq1 in `ls -rt success.msg* | grep -v lck*`
do
#####################
cat $seq1 | awk '/^\[2011/||/^{H/||/^{1/{print $0 "@@@@" "'"$seq"'" "/msg/" "'"$seq1"'"}' >> $work_dir/successed_tmp1.log
cat $work_dir/successed_tmp1.log | awk '/^{H/||^{1/' >> $work_dir/successed_tmp3.log
cat $work_dir/successed_tmp3.log | awk -F"@@@@" '{ print $1 }' >> $success_message_dir/$seq1.log
echo "================================================================================================" >> $success_message_dir/$seq1.log
echo $seq/msg/$seq1 >> $work_dir/analysised_file.log
echo $seq"/msg/"$seq1" is analyzing!"
rm -rf $work_dir/successed_tmp.log
rm -rf $work_dir/successed_tmp1.log
rm -rf $work_dir/successed_tmp3.log
#Succeeded
#s_hvps_up_counts
echo "###################################################################################################" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
echo $seq/msg/$seq1 >> $work_dir/up_Global_successed_$aabb_$ccdd.log
s_hvps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^HVPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "HVPS $s_hvps_up_counts" >> $success_message_dir/$seq1.log
echo "HVPS $s_hvps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
########
########
#s_saps_up_counts
s_saps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^SAPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "SAPS $s_saps_up_counts" >> $success_message_dir/$seq1.log
echo "SAPS $s_saps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_nets_up_counts
s_nets_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^NETS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "NETS $s_nets_up_counts" >> $success_message_dir/$seq1.log
echo "NETS $s_nets_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_beps_up_counts
s_beps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^BEPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "BEPS $s_beps_up_counts" >> $success_message_dir/$seq1.log
echo "BEPS $s_beps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_ibps_up_counts
sed -e 's/^.................//' $success_message_dir/$seq1.log | grep "^IBPS" >> $work_dir/ibps_succ.log
s_ibps_up_counts=`cat $work_dir/ibps_succ.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^IBPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "IBPS $s_ibps_up_counts" >> $success_message_dir/$seq1.log
echo "IBPS $s_ibps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_ccms_up_counts
s_ccms_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^CCMS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "CCMS $s_ccms_up_counts" >> $success_message_dir/$seq1.log
echo "CCMS $s_ccms_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_pmts_up_counts
s_pmts_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^PMTS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "PMTS $s_pmts_up_counts" >> $success_message_dir/$seq1.log
echo "PMTS $s_pmts_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
#s_fxps_up_counts
s_fxps_up_counts=`cat $work_dir/successed_tmp.log | grep "^{1" | cut -c 33 | wc -l`
echo "FXPS $s_fxps_up_counts" >> $success_message_dir/$seq1.log
echo "FXPS $s_fxps_up_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
##################################################################
up_succeed_counts=$(( $s_hvps_up_counts + $s_saps_up_counts + $s_nets_up_counts + $s_beps_up_counts + $s_ibps_up_counts + $s_ccms_up_counts + $s_pmts_up_counts + $s_fxps_up_counts ))
all_counts=`cat $success_message_dir/$seq1.log | awk '/^{H/||/^{1/' | wc -l`
Global_all=$(( $all_counts + $Global_all ))
up_Global_success=$(( $up_Global_success + $up_succeed_counts ))
echo "============================================================================================" >> $success_message_dir/$seq1.log
echo "all_succeed message are $all_counts" >> $success_message_dir/$seq1.log
echo "up_succeed message are $up_succeed_counts" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
rm -rf $work_dir/ibps_succ.log
done
echo "============================================================================================" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
echo $seq >> $work_dir/up_Global_successed_$aabb_$ccdd.log
echo "$Global_all message have been sent, up_succeed messages are $up_Global_success!" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
echo "============================================================================================" >> $work_dir/up_Global_successed_$aabb_$ccdd.log
done
##############################################################################################################################
##############################################################################################################################
##############################################################################################################################
#failed
for seq in `cat $work_dir/documents_list.log`
do
Global_all=0
up_Global_success=0
Global_failed=0
date_dir=`echo $seq | awk -F"/" '{ print $NF }'`
mkdir -p $work_dir"/failed_message/"$date_dir
failed_message_dir=$work_dir"/failed_message/"$date_dir
cd $seq/msg
for seq1 in `ls -rt fail.msg* | grep -v lck*`
do
#####################
cat $seq1 | awk '/^\[2011/||/^{H/||/^{1/{print $0 "@@@@" "'"$seq"'" "/msg/" "'"$seq1"'"}' >> $work_dir/failed_tmp1.log
cat $work_dir/failed_tmp1.log | awk '/^{H/||^{1/' >> $work_dir/failed_tmp3.log
cat $work_dir/failed_tmp3.log | awk -F"@@@@" '{ print $aabb }' >> $failed_message_dir/$seq1.log
echo "================================================================================================" >> $failed_message_dir/$seq1.log
echo $seq/msg/$seq1 >> $work_dir/analysised_file.log
echo $seq"/msg/"$seq1" is analyzing!"
rm -rf $work_dir/failed_tmp.log
rm -rf $work_dir/failed_tmp1.log
rm -rf $work_dir/failed_tmp3.log
#failed
#s_hvps_up_counts
echo "###################################################################################################" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
echo $seq/msg/$seq1 >> $work_dir/up_Global_failed_$aabb_$ccdd.log
s_hvps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^HVPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "HVPS $s_hvps_up_counts" >> $failed_message_dir/$seq1.log
echo "HVPS $s_hvps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
########
########
#s_saps_up_counts
s_saps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^SAPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "SAPS $s_saps_up_counts" >> $failed_message_dir/$seq1.log
echo "SAPS $s_saps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_nets_up_counts
s_nets_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^NETS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "NETS $s_nets_up_counts" >> $failed_message_dir/$seq1.log
echo "NETS $s_nets_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_beps_up_counts
s_beps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^BEPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "BEPS $s_beps_up_counts" >> $failed_message_dir/$seq1.log
echo "BEPS $s_beps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_ibps_up_counts
sed -e 's/^.................//' $failed_message_dir/$seq1.log | grep "^IBPS" >> $work_dir/ibps_succ.log
s_ibps_up_counts=`cat $work_dir/ibps_succ.log | sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "IBPS $s_ibps_up_counts" >> $failed_message_dir/$seq1.log
echo "IBPS $s_ibps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_ccms_up_counts
s_ccms_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^CCMS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "CCMS $s_ccms_up_counts" >> $failed_message_dir/$seq1.log
echo "CCMS $s_ccms_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_pmts_up_counts
s_pmts_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^PMTS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "PMTS $s_pmts_up_counts" >> $failed_message_dir/$seq1.log
echo "PMTS $s_pmts_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
#s_fxps_up_counts
s_fxps_up_counts=`cat $failed_message_dir/$seq1.log | grep "^{1" | cut -c 33 | wc -l`
echo "FXPS $s_fxps_up_counts" >> $failed_message_dir/$seq1.log
echo "FXPS $s_fxps_up_counts" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
##################################################################
up_Global_failed=$(( $s_hvps_up_counts + $s_saps_up_counts + $s_nets_up_counts + $s_beps_up_counts + $s_ibps_up_counts + $s_ccms_up_counts + $s_pmts_up_counts + $s_fxps_up_counts ))
all_counts=`cat $failed_message_dir/$seq1.log | awk '/^{H/||/^{1/' | wc -l`
Global_all=$(( $all_counts + $Global_all ))
up_Global_failed=$(( $up_Global_failed + $up_Global_failed ))
echo "============================================================================================" >> $failed_message_dir/$seq1.log
echo "all_failed message are $all_counts" >> $failed_message_dir/$seq1.log
echo "up_failed message are $up_Global_failed" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
rm -rf $work_dir/ibps_succ.log
done
echo "============================================================================================" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
echo $seq >> $work_dir/up_Global_failed_$aabb_$ccdd.log
echo "$Global_all message have been sent, up_failed messages are $up_Global_failed!" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
echo "============================================================================================" >> $work_dir/up_Global_failed_$aabb_$ccdd.log
done
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/failed_message
rm -rf $work_dir/success_message
fi
############################################################################################################################
############################################################################################################################
if [ $# = 2 ];then
touch $work_dir/successed_tmp.log
touch $work_dir/failed_tmp.log
#######################################
time_year_s=`echo $1 | cut -c 1-4`
time_month_s=`echo $1 | cut -c 5-6`
time_day_s=`echo $1 | cut -c 7-8`
time_hour_s=`echo $1 | cut -c 9-10`
time_minute_s=`echo $1 | cut 11-12`
time_second_s=`echo $1 | cut 13-14`
##################################
time_year_e=`echo $2 | cut -c 1-4`
time_month_e=`echo $2 | cut -c 5-6`
time_day_e=`echo $2 | cut -c 7-8`
time_hour_e=`echo $2 | cut -c 9-10`
time_minute_e=`echo $2 | cut 11-12`
time_second_e=`echo $2 | cut 13-14`
##################################
serch_tag_s=`echo $1 | cut -c 1-8`
serch_tag_e=`echo $2 | cut -c 1-8`
#########################################
log_serch_tag_s=$time_year_s"-"$time_month_s"-"$time_day_s" "$time_hour_s":"$time_minute_s
log_serch_tag_e=$time_year_e"-"$time_month_e"-"$time_day_e" "$time_hour_e":"$time_minute_e
find /cnaps2/$system_type_Lowercase/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
###############################################################################################################################
cat $work_dir/documents_name.log | while read LINE
do
zzzz=`echo $LINE | awk -F"/" '{ print $5 }'`
if [ "$zzzz" -ge "$serch_tag_s" ] && [ "$zzzz" -le "$log_serch_tag_e" ];then
cat $work_dir/documents_name.log | grep $zzzz >> $work_dir/documents_list.log
fi
done
###############################################################################################################################
for seq in `cat $work_dir/documents_list.log`
do
Global_all=0
up_Global_success=0
Global_failed=0
date_dir=`echo $seq | awk -F"/" '{ print $NF }'`
mkdir -p $work_dir"/success_message/"$date_dir
success_message_dir=$work_dir"/success_message/"$date_dir
cd $seq/msg
for seq1 in `ls -rt success.msg* | grep -v lck*`
do
#####################
cat $seq1 | awk '/^\[2011/||/^{H/||/^{1/{print $0 "@@@@" "'"$seq"'" "/msg/" "'"$seq1"'"}' >> $work_dir/successed_tmp.log
cat $work_dir/successed_tmp.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $work_dir/successed_tmp1.log
cat $work_dir/successed_tmp1.log | awk '/^{H/||^{1/' >> $work_dir/successed_tmp3.log
cat $work_dir/successed_tmp3.log | awk -F"@@@@" '{ print $1 }' >> $success_message_dir/$seq1.log
echo "================================================================================================" >> $success_message_dir/$seq1.log
echo $seq/msg/$seq1 >> $work_dir/analysised_file.log
echo $seq"/msg/"$seq1" is analyzing!"
rm -rf $work_dir/successed_tmp.log
rm -rf $work_dir/successed_tmp1.log
rm -rf $work_dir/successed_tmp3.log
#Succeeded
#s_hvps_up_counts
echo "###################################################################################################" >> $work_dir/up_Global_successed_$1_$2.log
echo $seq/msg/$seq1 >> $work_dir/up_Global_successed_$$1_$2.log
s_hvps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^HVPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "HVPS $s_hvps_up_counts" >> $success_message_dir/$seq1.log
echo "HVPS $s_hvps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
########
########
#s_saps_up_counts
s_saps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^SAPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "SAPS $s_saps_up_counts" >> $success_message_dir/$seq1.log
echo "SAPS $s_saps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_nets_up_counts
s_nets_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^NETS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "NETS $s_nets_up_counts" >> $success_message_dir/$seq1.log
echo "NETS $s_nets_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_beps_up_counts
s_beps_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^BEPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "BEPS $s_beps_up_counts" >> $success_message_dir/$seq1.log
echo "BEPS $s_beps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_ibps_up_counts
sed -e 's/^.................//' $success_message_dir/$seq1.log | grep "^IBPS" >> $work_dir/ibps_succ.log
s_ibps_up_counts=`cat $work_dir/ibps_succ.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^IBPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "IBPS $s_ibps_up_counts" >> $success_message_dir/$seq1.log
echo "IBPS $s_ibps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_ccms_up_counts
s_ccms_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^CCMS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "CCMS $s_ccms_up_counts" >> $success_message_dir/$seq1.log
echo "CCMS $s_ccms_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_pmts_up_counts
s_pmts_up_counts=`cat $success_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^PMTS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "PMTS $s_pmts_up_counts" >> $success_message_dir/$seq1.log
echo "PMTS $s_pmts_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
#s_fxps_up_counts
s_fxps_up_counts=`cat $work_dir/successed_tmp.log | grep "^{1" | cut -c 33 | wc -l`
echo "FXPS $s_fxps_up_counts" >> $success_message_dir/$seq1.log
echo "FXPS $s_fxps_up_counts" >> $work_dir/up_Global_successed_$1_$2.log
##################################################################
up_succeed_counts=$(( $s_hvps_up_counts + $s_saps_up_counts + $s_nets_up_counts + $s_beps_up_counts + $s_ibps_up_counts + $s_ccms_up_counts + $s_pmts_up_counts + $s_fxps_up_counts ))
all_counts=`cat $success_message_dir/$seq1.log | awk '/^{H/||/^{1/' | wc -l`
Global_all=$(( $all_counts + $Global_all ))
up_Global_success=$(( $up_Global_success + $up_succeed_counts ))
echo "============================================================================================" >> $success_message_dir/$seq1.log
echo "all_succeed message are $all_counts" >> $success_message_dir/$seq1.log
echo "up_succeed message are $up_succeed_counts" >> $work_dir/up_Global_successed_$1_$2.log
rm -rf $work_dir/ibps_succ.log
done
echo "============================================================================================" >> $work_dir/up_Global_successed_$1_$2.log
echo $seq >> $work_dir/up_Global_successed_$1_$2.log
echo "$Global_all message have been sent, up_succeed messages are $up_Global_success!" >> $work_dir/up_Global_successed_$1_$2.log
echo "============================================================================================" >> $work_dir/up_Global_successed_$1_$2.log
done
##############################################################################################################################
##############################################################################################################################
##############################################################################################################################
#failed
for seq in `cat $work_dir/documents_list.log`
do
Global_all=0
up_Global_success=0
Global_failed=0
date_dir=`echo $seq | awk -F"/" '{ print $NF }'`
mkdir -p $work_dir"/failed_message/"$date_dir
failed_message_dir=$work_dir"/failed_message/"$date_dir
cd $seq/msg
for seq1 in `ls -rt fail.msg* | grep -v lck*`
do
#####################
cat $seq1 | awk '/^\[2011/||/^{H/||/^{1/{print $0 "@@@@" "'"$seq"'" "/msg/" "'"$seq1"'"}' >> $work_dir/failed_tmp.log
cat $work_dir/failed_tmp.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $work_dir/failed_tmp1.log
cat $work_dir/failed_tmp1.log | awk '/^{H/||^{1/' >> $work_dir/failed_tmp3.log
cat $work_dir/failed_tmp3.log | awk -F"@@@@" '{ print $aabb }' >> $failed_message_dir/$seq1.log
echo "================================================================================================" >> $failed_message_dir/$seq1.log
echo $seq/msg/$seq1 >> $work_dir/analysised_file.log
echo $seq"/msg/"$seq1" is analyzing!"
rm -rf $work_dir/failed_tmp.log
rm -rf $work_dir/failed_tmp1.log
rm -rf $work_dir/failed_tmp3.log
#failed
#s_hvps_up_counts
echo "###################################################################################################" >> $work_dir/up_Global_failed_$1_$2.log
echo $seq/msg/$seq1 >> $work_dir/up_Global_failed_$1_$2.log
s_hvps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^HVPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "HVPS $s_hvps_up_counts" >> $failed_message_dir/$seq1.log
echo "HVPS $s_hvps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
########
########
#s_saps_up_counts
s_saps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^SAPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "SAPS $s_saps_up_counts" >> $failed_message_dir/$seq1.log
echo "SAPS $s_saps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_nets_up_counts
s_nets_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^NETS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "NETS $s_nets_up_counts" >> $failed_message_dir/$seq1.log
echo "NETS $s_nets_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_beps_up_counts
s_beps_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^BEPS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "BEPS $s_beps_up_counts" >> $failed_message_dir/$seq1.log
echo "BEPS $s_beps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_ibps_up_counts
sed -e 's/^.................//' $failed_message_dir/$seq1.log | grep "^IBPS" >> $work_dir/ibps_succ.log
s_ibps_up_counts=`cat $work_dir/ibps_succ.log | sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "IBPS $s_ibps_up_counts" >> $failed_message_dir/$seq1.log
echo "IBPS $s_ibps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_ccms_up_counts
s_ccms_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^CCMS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "CCMS $s_ccms_up_counts" >> $failed_message_dir/$seq1.log
echo "CCMS $s_ccms_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_pmts_up_counts
s_pmts_up_counts=`cat $failed_message_dir/$seq1.log | sed -e 's/[^ ]* //'| sed -e 's/^[ ]*//g' | grep "^PMTS"| sed 's/.*\(.\{10\}\)}.*/\1/' | grep "^U" | wc -l`
echo "PMTS $s_pmts_up_counts" >> $failed_message_dir/$seq1.log
echo "PMTS $s_pmts_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
#s_fxps_up_counts
s_fxps_up_counts=`cat $failed_message_dir/$seq1.log | grep "^{1" | cut -c 33 | wc -l`
echo "FXPS $s_fxps_up_counts" >> $failed_message_dir/$seq1.log
echo "FXPS $s_fxps_up_counts" >> $work_dir/up_Global_failed_$1_$2.log
##################################################################
up_Global_failed=$(( $s_hvps_up_counts + $s_saps_up_counts + $s_nets_up_counts + $s_beps_up_counts + $s_ibps_up_counts + $s_ccms_up_counts + $s_pmts_up_counts + $s_fxps_up_counts ))
all_counts=`cat $failed_message_dir/$seq1.log | awk '/^{H/||/^{1/' | wc -l`
Global_all=$(( $all_counts + $Global_all ))
up_Global_failed=$(( $up_Global_failed + $up_Global_failed ))
echo "============================================================================================" >> $failed_message_dir/$seq1.log
echo "all_failed message are $all_counts" >> $failed_message_dir/$seq1.log
echo "up_failed message are $up_Global_failed" >> $work_dir/up_Global_failed_$1_$2.log
rm -rf $work_dir/ibps_succ.log
done
echo "============================================================================================" >> $work_dir/up_Global_failed_$1_$2.log
echo $seq >> $work_dir/up_Global_failed_$1_$2.log
echo "$Global_all message have been sent, up_failed messages are $up_Global_failed!" >> $work_dir/up_Global_failed_$1_$2.log
echo "============================================================================================" >> $work_dir/up_Global_failed_$1_$2.log
done
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/failed_message
rm -rf $work_dir/success_message #Quering queue
echo "Quering queue now (ERRMSG DEADQ)"
rf -rf $work_dir/queue_ERRMSG.log $work_dir/queue_DEADQ.log
qmName=`dspmq | grep $system_type | awk '{print $1}' | sed -e 's/^QMNAME(//;s/)//'`
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqERRMSG >> queue_ERRMSG.log && exit"
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqDEADQ >> queue_DEADQ.log && exit"
cp /cnaps2/$system_type_Lowercase/queue_ERRMSG.log $work_dir/queue_ERRMSG.log
cp /cnaps2/$system_type_Lowercase/queue_DEADQ.log $work_dir/queue_DEADQ.log
rm -rf /cnaps2/$system_type_Lowercase/queue_ERRMSG.log /cnaps2/$system_type_Lowercase/queue_DEADQ.log
fi ########################################################################################
#FXCC
########################################################################################
if [[ $system_type = "FXCC" ]];then
now_dir=`pwd`
mkdir -p $now_dir"/"monitor"/"$system_type
work_dir=$now_dir"/"monitor"/"$system_type
temp_line=""
tag=""
succeed_counts=""
fail_counts=""
all_counts=""
Global_all=0
Global_success=0
Global_failed=0
#collecting corefile documents
#collecting dumps documents
rm -rf $work_dir/core_file_list $work_dir/dump_file_list.log
cd /corefiles
ls -lrt core* >> $work_dir/core_file_list
echo "Collecting dumps documents"
dump_file_dir=`df -g | grep "/dumps/dir1" | awk '{print $7}'`
cd $dump_file_dir
ls -lrt ShowProcInfoDump* >> $work_dir/dump_file_list.log
#############################################################################################################
#############################################################################################################
#Collecting and Analysising message documents
echo "Collecting and Analysising message documents"
if [ $# = 0 ];then
for seq1 in `find /fxcc/log/WRMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d`
do
cd $seq1
for seq4 in `ls -rt 8888_* | grep -v *lck`
do
date_dir=`echo $seq1 | awk -F"/" '{ print $5}'`
mkdir -p $work_dir"/failed_message/WRMC/"$date_dir
mkdir -p $work_dir"/all_message/WRMC/"$date_dir
failelmessage_dir=$work_dir"/failed_message/WRMC/"$date_dir
allmessage_dir=$work_dir"/all_message/WRMC/"$date_dir
echo $seq1"/"$seq4" is analyzing!"
echo $seq1"/"$seq4 >> $allmessage_dir/$seq4.log
cat $seq4 | awk '/^\[2018/||/^\*\*/{print $0 "'"$seq1"'" "/" "'"$seq4"'"}' | grep -v "{" >> $allmessage_dir/$seq4.log
perl -e 'print reverse <>' $allmessage_dir/$seq4.log >> $work_dir/WRMC_template1.log
sed '/PF1I0000/{N;d; }' $work_dir/WRMC_template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/WRMC_template2.log
perl -e 'print reverse <>' $work_dir/WRMC_template2.log >> $filelmessage_dir/$seq4.log
########################################################################################
WRMC_succeeded_counts=`cat $allmessage_dir/$seq4.log | grep "PF1I0000" | wc -l`
WRMC_all_counts=`cat $allmessage_dir/$seq4.log | grep "^\[2018" | wc -l`
WRMC_fail_counts=`cat $failelmessage_dir/$seq4.log | grep "^\*\*" | grep $seq1 | grep -v "PF1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq4.log
echo "**************************************************************" >> $failelmessage_dir/$seq4.log
echo $seq1"/"$seq4 >> $failelmessage_dir/$seq4.log
echo "messages of $seq1"/"$seq4 are calculating"
echo "$WRMC_all messages have been sent,among them $WRMC_succeeded_counts have been sent successfully,$WRMC_fail_counts of them was sent failed!" >> $failelmessage_dir/$seq4.log
########################################################################################
Global_all=$(( $WRMC_all_counts + $Global_all ))
Global_success=$(( $Global_success + $WRMC_succeeded_counts ))
Global_failed=$(( $Global_failed + $WRMC_fail_counts ))
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $seq1"/"$seq4 >> $work_dir/Glo_$1"_"$2.log
echo "$WRMC_all_counts messages have been sent,among them $WRMC_succeeded_counts have been sent successfully,$WRMC_fail_counts of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
rm -rf $work_dir/WRMC_template1.log
rm -rf $work_dir/WRMC_template2.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
done
done
###########################################################################################################
for seq2 in `find /fxcc/log/WBMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d`
do
cd $seq2
for seq3 in `ls -rt 8888_* | grep -v *lck`
do
date_dir=`echo $seq2 | awk -F"/" '{ print $5}'`
mkdir -p $work_dir"/failed_message/WBMC/"$date_dir
mkdir -p $work_dir"/all_message/WBMC/"$date_dir
failelmessage_dir=$work_dir"/failed_message/WBMC/"$date_dir
allmessage_dir=$work_dir"/all_message/WBMC/"$date_dir
echo $seq2"/"$seq3" is analyzing!"
echo $seq2"/"$seq3 >> $allmessage_dir/$seq3.log
cat $seq3 | awk '/^\[2018/||/^\*\*/{print $0 "'"$seq2"'" "/" "'"$seq3"'"}' | grep -v "{" >> $allmessage_dir/$seq3.log
perl -e 'print reverse <>' $allmessage_dir/$seq3.log >> $work_dir/WBMC_template1.log
sed '/PF1I0000/{N;d; }' $work_dir/WBMC_template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/WBMC_template2.log
perl -e 'print reverse <>' $work_dir/WBMC_template2.log >> $filelmessage_dir/$seq3.log
########################################################################################
WBMC_succeeded_counts=`cat $allmessage_dir/$seq3.log | grep "PF1I0000" | wc -l`
WBMC_all_counts=`cat $allmessage_dir/$seq3.log | grep "^\[2018" | wc -l`
WBMC_fail_counts=`cat $failelmessage_dir/$seq3.log | grep "^\*\*" | grep $seq2 | grep -v "PF1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq3.log
echo "**************************************************************" >> $failelmessage_dir/$seq3.log
echo $seq2"/"$seq3 >> $failelmessage_dir/$seq3.log
echo "messages of $seq2"/"$seq3 are calculating"
echo "$WBMC_all messages have been sent,among them $WBMC_succeeded_counts have been sent successfully,$WBMC_fail_counts of them was sent failed!" >> $failelmessage_dir/$seq3.log
########################################################################################
Global_all=$(( $WBMC_all_counts + $Global_all ))
Global_success=$(( $Global_success + $WBMC_succeeded_counts ))
Global_failed=$(( $Global_failed + $WBMC_fail_counts ))
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $seq2"/"$seq3 >> $work_dir/Glo_$1"_"$2.log
echo "$WBMC_all_counts messages have been sent,among them $WBMC_succeeded_counts have been sent successfully,$WBMC_fail_counts of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
rm -rf $work_dir/WBMC_template1.log
rm -rf $work_dir/WBMC_template2.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
done
echo "===============================================================================================================" >> $work_dir/Glo_$1"_"$2.log
echo $seq2 >> $work_dir/Glo_$1"_"$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
echo "===============================================================================================================" >> $work_dir/Glo_$1"_"$2.log
done
rm -rf $work_dir/all_message
fi
###########################################################################################################
if [ $# = 2 ];then
time_year_s=`echo $1 | cut -c 1-4`
time_month_s=`echo $1 | cut -c 5-6`
time_day_s=`echo $1 | cut -c 7-8`
time_hour_s=`echo $1 | cut -c 9-10`
time_minute_s=`echo $1 | cut 11-12`
time_second_s=`echo $1 | cut 13-14`
##################################
time_year_e=`echo $2 | cut -c 1-4`
time_month_e=`echo $2 | cut -c 5-6`
time_day_e=`echo $2 | cut -c 7-8`
time_hour_e=`echo $2 | cut -c 9-10`
time_minute_e=`echo $2 | cut 11-12`
time_second_e=`echo $2 | cut 13-14`
##################################
serch_tag_s=`echo $1 | cut -c 1-8`
serch_tag_e=`echo $2 | cut -c 1-8`
##################################
log_serch_tag_s=$time_year_s"-"$time_month_s"-"$time_day_s" "$time_hour_s":"$time_minute_s
log_serch_tag_e=$time_year_e"-"$time_month_e"-"$time_day_e" "$time_hour_e":"$time_minute_e
find /fxcc/log/WRMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
cat $work_dir/documents_name.log | while read LINE
do
ZZZZ=`echo $LINE | awk -F"/" '{ print $5 }'`
if [ "$ZZZZ" -ge "$serch_tag_s" ] && [ "$ZZZZ" -le "$serch_tag_e" ];then
cat $work_dir/documents_name.log | grep $ZZZZ >> $work_dir/documents_list.log
fi
done
for seq1 in `cat $work_dir/documents_list.log`
do
cd $seq1
for seq4 in `ls -rt 8888_* | grep -v *lck`
do
date_dir=`echo $seq1 | awk -F"/" '{ print $5}'`
mkdir -p $work_dir"/failed_message/WRMC/"$date_dir
mkdir -p $work_dir"/all_message/WRMC/"$date_dir
failelmessage_dir=$work_dir"/failed_message/WRMC/"$date_dir
allmessage_dir=$work_dir"/all_message/WRMC/"$date_dir
echo $seq1"/"$seq4" is analyzing!"
echo $seq1"/"$seq4 >> $allmessage_dir/$seq4.log
cat $seq4 | awk '/^\[2018/||/^\*\*/{print $0 "'"$seq1"'" "/" "'"$seq4"'"}' | grep -v "{" >> $work_dir/template.log
cat $work_dir/template.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $allmessage_dir/$seq4.log
rm -rf $work_dir/template.log
########################################################
########################################################
########################################################
perl -e 'print reverse <>' $allmessage_dir/$seq4.log >> $work_dir/WRMC_template1.log
sed '/PF1I0000/{N;d; }' $work_dir/WRMC_template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/WRMC_template2.log
perl -e 'print reverse <>' $work_dir/WRMC_template2.log >> $filelmessage_dir/$seq4.log
########################################################################################
WRMC_succeeded_counts=`cat $allmessage_dir/$seq4.log | grep "PF1I0000" | wc -l`
WRMC_all_counts=`cat $allmessage_dir/$seq4.log | grep "^\[2018" | wc -l`
WRMC_fail_counts=`cat $failelmessage_dir/$seq4.log | grep "^\*\*" | grep $seq1 | grep -v "PF1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq4.log
echo "**************************************************************" >> $failelmessage_dir/$seq4.log
echo $seq1"/"$seq4 >> $failelmessage_dir/$seq4.log
echo "messages of $seq1"/"$seq4 are calculating"
echo "$WRMC_all messages have been sent,among them $WRMC_succeeded_counts have been sent successfully,$WRMC_fail_counts of them was sent failed!" >> $failelmessage_dir/$seq4.log
########################################################################################
Global_all=$(( $WRMC_all_counts + $Global_all ))
Global_success=$(( $Global_success + $WRMC_succeeded_counts ))
Global_failed=$(( $Global_failed + $WRMC_fail_counts ))
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $seq1"/"$seq4 >> $work_dir/Glo_$1"_"$2.log
echo "$WRMC_all_counts messages have been sent,among them $WRMC_succeeded_counts have been sent successfully,$WRMC_fail_counts of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
rm -rf $work_dir/WRMC_template1.log
rm -rf $work_dir/WRMC_template2.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
done
done
##################################################################################
rm -rf $work_dir/documents_name.log
find /fxcc/log/WBMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
cat $work_dir/documents_name.log | while read LINE
do
ZZZZ=`echo $LINE | awk -F"/" '{ print $5 }'`
if [ "$ZZZZ" -ge "$serch_tag_s" ] && [ "$ZZZZ" -le "$serch_tag_e" ];then
cat $work_dir/documents_name.log | grep $ZZZZ >> $work_dir/documents_list.log
fi
done
for seq2 in `cat $work_dir/documents_list.log`
do
cd $seq2
for seq3 in `ls -rt 8888_* | grep -v *lck`
do
date_dir=`echo $seq2 | awk -F"/" '{ print $5}'`
mkdir -p $work_dir"/failed_message/WBMC/"$date_dir
mkdir -p $work_dir"/all_message/WBMC/"$date_dir
failelmessage_dir=$work_dir"/failed_message/WBMC/"$date_dir
allmessage_dir=$work_dir"/all_message/WBMC/"$date_dir
echo $seq2"/"$seq3" is analyzing!"
echo $seq2"/"$seq3 >> $allmessage_dir/$seq3.log
cat $seq3 | awk '/^\[2018/||/^\*\*/{print $0 "'"$seq2"'" "/" "'"$seq3"'"}' | grep -v "{" >> $work_dir/template.log
cat $work_dir/template.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $allmessage_dir/$seq3.log
rm -rf $work_dir/template.log
########################################################
########################################################
########################################################
perl -e 'print reverse <>' $allmessage_dir/$seq3.log >> $work_dir/WBMC_template1.log
sed '/PF1I0000/{N;d; }' $work_dir/WBMC_template1.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/WBMC_template2.log
perl -e 'print reverse <>' $work_dir/WBMC_template2.log >> $filelmessage_dir/$seq3.log
########################################################################################
WBMC_succeeded_counts=`cat $allmessage_dir/$seq3.log | grep "PF1I0000" | wc -l`
WBMC_all_counts=`cat $allmessage_dir/$seq3.log | grep "^\[2018" | wc -l`
WBMC_fail_counts=`cat $failelmessage_dir/$seq3.log | grep "^\*\*" | grep $seq2 | grep -v "PF1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq3.log
echo "**************************************************************" >> $failelmessage_dir/$seq3.log
echo $seq2"/"$seq3 >> $failelmessage_dir/$seq3.log
echo "messages of $seq2"/"$seq3 are calculating"
echo "$WBMC_all messages have been sent,among them $WBMC_succeeded_counts have been sent successfully,$WBMC_fail_counts of them was sent failed!" >> $failelmessage_dir/$seq3.log
########################################################################################
Global_all=$(( $WBMC_all_counts + $Global_all ))
Global_success=$(( $Global_success + $WBMC_succeeded_counts ))
Global_failed=$(( $Global_failed + $WBMC_fail_counts ))
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $seq2"/"$seq3 >> $work_dir/Glo_$1"_"$2.log
echo "$WBMC_all_counts messages have been sent,among them $WBMC_succeeded_counts have been sent successfully,$WBMC_fail_counts of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
rm -rf $work_dir/WBMC_template1.log
rm -rf $work_dir/WBMC_template2.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
done
echo "===============================================================================================================" >> $work_dir/Glo_$1"_"$2.log
echo $seq2 >> $work_dir/Glo_$1"_"$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
echo "===============================================================================================================" >> $work_dir/Glo_$1"_"$2.log
done
fi
#############################################
#############################################
#############################################
#Quering queue
echo "Quering queue now (ERRMSG DEADQ)"
rf -rf $work_dir/queue_ERRMSG.log $work_dir/queue_DEADQ.log
qmName=`dspmq | grep "8888" | awk '{print $1}' | sed -e 's/^QMNAME(//;s/)//'`
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqERRMSG >> queue_ERRMSG.log && exit"
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqDEADQ >> queue_DEADQ.log && exit"
cp /cnaps2/$system_type_Lowercase/queue_ERRMSG.log $work_dir/queue_ERRMSG.log
cp /cnaps2/$system_type_Lowercase/queue_DEADQ.log $work_dir/queue_DEADQ.log
rm -rf /cnaps2/$system_type_Lowercase/queue_ERRMSG.log /cnaps2/$system_type_Lowercase/queue_DEADQ.log
fi #################################################################################
#CIPS
#################################################################################
if [[ $system_type = "CIPS" ]];then
now_dir=`pwd`
mkdir -p $now_dir"/"monitor"/"$system_type
work_dir=$now_dir"/"monitor"/"$system_type
Global_all=0
Global_success=0
Global_failed=0
#collecting corefile documents
#collecting dumps documents
rm -rf $work_dir/core_file_list $work_dir/dump_file_list.log
cd /corefiles
ls -lrt core* >> $work_dir/core_file_list
echo "Collecting dumps documents"
dump_file_dir=`df -g | grep "/dumps/dir1" | awk '{print $7}'`
cd $dump_file_dir
ls -lrt ShowProcInfoDump* >> $work_dir/dump_file_list.log
#############################################################################################################
#############################################################################################################
#Collecting and Analysising message documents
find /cips/log -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
echo "Collecting and Analysising message documents"
if [ $# = 0 ];then
for LINE in `cat $work_dir/documents_name.log`
do
cd $LINE
Global_all=0
Global_success=0
Global_failed=0
for seq1 in `ls -lrt | grep "^d" | awk '{ print $9 }'`
do
eeeeeee=$LINE"/"$seq1
cd $eeeeeee
for seq2 in `ls -rt | grep -v lck`
do
date_dir=`echo $LINE | awk -F"/" '{ print $4}'`
mkdir -p $work_dir"/failed_message/"$date_dir"/"$seq1
mkdir -p $work_dir"/all_message/WRMC/"$date_dir"/"$seq1
failelmessage_dir=$work_dir"/failed_message/"$date_dir"/"$seq1
allmessage_dir=$work_dir"/all_message/WRMC/"$date_dir"/"$seq1
echo $LINE"/"$seq1"/"$seq2" is analyzing!"
echo $LINE"/"$seq1"/"$seq2 >> $allmessage_dir/$seq2.log
cat $seq2 | awk '/^\[201/||/^\*\*/{print $0 "'"$LINE"'" "/" "'"$seq1"'" "/" "'"$seq2"'"}' >> $allmessage_dir/$seq2.log
####################################################################
sed '/R000217/'d $allmessage_dir/$seq2.log >> $work_dir/template1.log
perl -e 'print reverse <>' $work_dir/template1.log >> $work_dir/template2.log
sed '/CI1I0000/{N;d; }' $work_dir/template2.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template3.log
####################################################################
perl -e 'print reverse <>' $work_dir/template3.log >> $failelmessage_dir/$seq2.log
########################################################################################
sum_all_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | grep "CI1I0000" | wc -l`
sum_fail_temp=`cat $failelmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | grep -v "CI1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo $LINE"/"$seq1"/"$seq2 >> $failelmessage_dir/$seq2.log
echo "messages of $LINE"/"$seq1"/"$seq2 are calculating"
echo "$sum_all_temp messages have been sent,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq2.log
########################################################################################
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $LINE"/"$seq1"/"$seq2 >> $work_dir/Glo_$1"_"$2.log
echo "$sum_all_temp messages have been sent,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
########################################################################################
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template2.log
rm -rf $work_dir/template3.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
rm -rf $work_dir/all_message
done
done
echo "=====================================================================================================" >> $work_dir/Glo_$1"_"$2.log
echo $LINE >> $work_dir/Glo_$1"_"$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
echo "=====================================================================================================" >> $work_dir/Glo_$1"_"$2.log
done
fi
###########################################################################################################
if [ $# = 2 ];then
time_year_s=`echo $1 | cut -c 1-4`
time_month_s=`echo $1 | cut -c 5-6`
time_day_s=`echo $1 | cut -c 7-8`
time_hour_s=`echo $1 | cut -c 9-10`
time_minute_s=`echo $1 | cut 11-12`
time_second_s=`echo $1 | cut 13-14`
##################################
time_year_e=`echo $2 | cut -c 1-4`
time_month_e=`echo $2 | cut -c 5-6`
time_day_e=`echo $2 | cut -c 7-8`
time_hour_e=`echo $2 | cut -c 9-10`
time_minute_e=`echo $2 | cut 11-12`
time_second_e=`echo $2 | cut 13-14`
##################################
serch_tag_s=`echo $1 | cut -c 1-8`
serch_tag_e=`echo $2 | cut -c 1-8`
##################################
log_serch_tag_s=$time_year_s"-"$time_month_s"-"$time_day_s" "$time_hour_s":"$time_minute_s
log_serch_tag_e=$time_year_e"-"$time_month_e"-"$time_day_e" "$time_hour_e":"$time_minute_e
find /fxcc/log/WRMC -name [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -type d >> $work_dir/documents_name.log
cat $work_dir/documents_name.log | while read LINE
do
ZZZZ=`echo $LINE | awk -F"/" '{ print $4 }'`
if [ "$ZZZZ" -ge "$serch_tag_s" ] && [ "$ZZZZ" -le "$serch_tag_e" ];then
cat $work_dir/documents_name.log | grep $ZZZZ >> $work_dir/documents_list.log
fi
done
###########################################
for LINE in `cat $work_dir/documents_name.log`
do
cd $LINE
Global_all=0
Global_success=0
Global_failed=0
for seq1 in `ls -lrt | grep "^d" | awk '{ print $9 }'`
do
eeeeeee=$LINE"/"$seq1
cd $eeeeeee
for seq2 in `ls -rt | grep -v lck`
do
date_dir=`echo $LINE | awk -F"/" '{ print $4}'`
mkdir -p $work_dir"/failed_message/"$date_dir"/"$seq1
mkdir -p $work_dir"/all_message/WRMC/"$date_dir"/"$seq1
failelmessage_dir=$work_dir"/failed_message/"$date_dir"/"$seq1
allmessage_dir=$work_dir"/all_message/WRMC/"$date_dir"/"$seq1
echo $LINE"/"$seq1"/"$seq2" is analyzing!"
echo $LINE"/"$seq1"/"$seq2 >> $allmessage_dir/$seq2.log
cat $seq2 | awk '/^\[201/||/^\*\*/{print $0 "'"$LINE"'" "/" "'"$seq1"'" "/" "'"$seq2"'"}' >> $work_dir/template.log
cat $work_dir/template.log | awk -F'[\\[\\.]' '{if($2>="'"$log_serch_tag_s"'"&&$2<="'"$log_serch_tag_e"'") {print $0;getline;print}}' >> $allmessage_dir/$seq2.log
rm -rf $work_dir/template.log
####################################################################
####################################################################
perl -e 'print reverse <>' $allmessage_dir/$seq2.log >> $work_dir/template2.log
sed '/CI1I0000/{N;d; }' $work_dir/template2.log | grep -v "Switch log file" | grep -v "\*\*\*\*" >> $work_dir/template3.log
####################################################################
perl -e 'print reverse <>' $work_dir/template3.log >> $failelmessage_dir/$seq2.log
########################################################################################
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
sum_all_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | wc -l`
sum_success_temp=`cat $allmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | grep "CI1I0000" | wc -l`
sum_fail_temp=`cat $failelmessage_dir/$seq2.log | grep "^\*\*" | grep $LINE | grep -v "CI1I0000" | wc -l`
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo "**************************************************************" >> $failelmessage_dir/$seq2.log
echo $LINE"/"$seq1"/"$seq2 >> $failelmessage_dir/$seq2.log
echo "messages of $LINE"/"$seq1"/"$seq2 are calculating"
echo "$sum_all_temp messages have been sent,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $failelmessage_dir/$seq2.log
########################################################################################
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo "########################################################################################" >> $work_dir/Glo_$1"_"$2.log
echo $LINE"/"$seq1"/"$seq2 >> $work_dir/Glo_$1"_"$2.log
echo "$sum_all_temp messages have been sent,among them $sum_success_temp have been sent successfully,$sum_fail_temp of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
########################################################################################
Global_all=$(( $sum_all_temp + $Global_all ))
Global_success=$(( $Global_success + $sum_success_temp ))
Global_failed=$(( $Global_failed + $sum_fail_temp ))
rm -rf $work_dir/template2.log
rm -rf $work_dir/template3.log
rm -rf $work_dir/documents_list.log
rm -rf $work_dir/documents_name.log
rm -rf $work_dir/all_message
done
done
echo "=====================================================================================================" >> $work_dir/Glo_$1"_"$2.log
echo $LINE >> $work_dir/Glo_$1"_"$2.log
echo "$Global_all messages have been sent,among them $Global_success have been sent successfully,$Global_failed of them was sent failed!" >> $work_dir/Glo_$1"_"$2.log
echo "=====================================================================================================" >> $work_dir/Glo_$1"_"$2.log
done
fi
#############################################
#Quering queue
echo "Quering queue now (ERRMSG DEADQ)"
rf -rf $work_dir/queue_ERRMSG.log $work_dir/queue_DEADQ.log
qmName=`dspmq | grep "8888" | awk '{print $1}' | sed -e 's/^QMNAME(//;s/)//'`
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqERRMSG >> queue_ERRMSG.log && exit"
su - $system_type_Lowercase -c "./tools/msgcp -M$qmName -SqDEADQ >> queue_DEADQ.log && exit"
cp /cnaps2/$system_type_Lowercase/queue_ERRMSG.log $work_dir/queue_ERRMSG.log
cp /cnaps2/$system_type_Lowercase/queue_DEADQ.log $work_dir/queue_DEADQ.log
rm -rf /cnaps2/$system_type_Lowercase/queue_ERRMSG.log /cnaps2/$system_type_Lowercase/queue_DEADQ.log
fi
#################################################################################
#IMGS
#################################################################################
monitor.sh的更多相关文章
- monitor.sh java脚本学习
#! /bin/bash# unset any variable which system may be using# clear the screen while getopts ivh named ...
- server宕机监控、检測、报警程序(139绑定手机短信报警)monitor_down.sh
宕机监控报警程序 一. 需求来源 宕机对运维人员来说,最痛苦了.怎样检測一台server是否还在正常执行,假设该server宕机,怎样在第一时间监測到并通知一线运维人员进行维护,最大化降低损失. ...
- Linux添加shell(.sh)脚本并添加定时任务
一.添加sheel脚本 1.首先创建一个执行程序:vim a.sh 2.编辑: #!/bin/bash python3 python.py >> test2.log 2>& ...
- linux上监控tomcat down掉后自动重启tomcat
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "Helvetica Neue"; color: #454545 } p. ...
- 在docker里面安装部署应用
最近一直在做docker的安装打包工作,学到不少东西,在博客里记一下. 环境centos6 ,docker 基础镜象centos6 1.创建本地基础镜象,安装基础命令包 (1)Dockerfile,D ...
- linux服务监控脚本
配置需要监控的服务器 数组定义:host_ports=(host_name=host_port=uri_path)host_name为容易识别的服务器名称host_port为服务器ip和服务端口uri ...
- Xvfb+YSlow+ShowSlow搭建前端性能测试框架 - 前端技术 | TaoBaoUED
Xvfb+YSlow+ShowSlow搭建前端性能测试框架 - 前端技术 | TaoBaoUED Xvfb+YSlow+ShowSlow搭建前端性能测试框架 作者:黑三 | 时间:2010-07-07 ...
- Linux看门狗脚本 1.4
近期项目的看门狗经历了三个版本号. 第一个版本号: 用ps -ef,假设程序挂了就启动 第二个版本号: 程序因为执行时会出现不再监听7901port,所以不能简单推断机器是不是挂了,而是推断此port ...
- 左右linuxserver自己主动重启过程监控和简单的解决方案
转载请注明出处:帘卷西风的专栏(http://blog.csdn.net/ljxfblog) 本周開始,新手游进行删档封測阶段,前两天表现还好,今天更新后出现几次宕机行为.比較影响玩家的測试和体验,我 ...
随机推荐
- Js修改input值后怎么同步修改绑定的v-model值
v-model只是一种语法糖,底层的方法还是去监听input事件.所以可以使用dispatchEvent事件给元素分配一个input事件,这样可以手动触发 inputElement 的 input 事 ...
- 异常处理——java基础
Evernote Export 异常处理 异常处理的套路模板: try//创建异常处理{ throw new();//抛出异常 //一旦有异常, 抛出异常后,后面的语句不再执行 语句;{ …… ...
- TP5框架 nginx服务器 配置域名 隐藏index.php
server { listen ; #server_name localhost; server_name hhy.com;/**这里写自己的域名*/ #charset koi8-r; #access ...
- 如何快速判断一个key是否存在在亿级数据中(bloomFilters)
面试题 现在有一个非常庞大的数据(亿级),假设全是 int 类型.现在我给你一个数,你需要告诉我它是否存在其中(尽量高效) 分析 采用bloomFilters进行实现(时间&空间尽可能的有效) ...
- mysql数据库的备份
有时会遇到需要重装虚拟机的情况,这时候之前创建好的数据库就需要备份啦,等重新装好虚拟机直接导入就可以正常使用. 数据库备份大体分为两步: 第一步.导出数据库,因为是备份,会将所有的数据库导出,因此需要 ...
- 【转载】 “强化学习之父”萨顿:预测学习马上要火,AI将帮我们理解人类意识
原文地址: https://yq.aliyun.com/articles/400366 本文来自AI新媒体量子位(QbitAI) ------------------------------- ...
- c++中好用的函数
isdigit()返回是否是数字字符: isalpha()返回是否是字母字符: isupper()返回是否是大写字母: islower()返回是否是小写字母:
- 动态改变Spring定时任务执行频率
@Component@EnableSchedulingpublic class updateCronTask implements SchedulingConfigurer { public stat ...
- JavaSE-类
一.基础概念:计算机语言的发展是接近人的思维方式演变:汇编语言(面向机器).C语言(面向过程).java(面向对象) 二.成员变量和局部变量: 1.全名定义一个类: Package 包名: Class ...
- vue—data中变量和字符串拼接
#变量和字符串的拼接# 写项目中,遇到了这样的一个问题:怎样在一个div里面显示两个data中的数据?我的问题描述清楚了吗?... 看图吧: 这是用户最初的需求~ 这是用户后来的需求,嗯……就是 ...