文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>searchd 日志 获取 百分比 处理

searchd 日志 获取 百分比 处理

时间:2010-10-12  来源:sxxs001

#!/bin/bash

pid=`cat /usr/local/coreseek/var/log/searchd.pid`
echo " `date` coreseek's pid is $pid " >> coreseek.log
kill -9 $pid
cd /usr/local/coreseek/var/log/
mv query.log query.log.`date +%m%d_%Y -d '-1 day'`
sleep 5
/usr/local/coreseek/bin/searchd
cd /root/script
newpid=`cat /usr/local/coreseek/var/log/searchd.pid`
echo " `date` coreseek's new pid is $newpid " >> coreseek.log


#cd /root/script
zt=`date +%m%d_%Y -d '-1 day' `
zs=` cat /usr/local/coreseek/var/log/query.log.$zt | awk -F ' ' '{print $6}' | wc -l `
a=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.1) print $0}'  |wc -l `
b=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.2) print $0}'  |wc -l `
c=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.3) print $0}'  |wc -l `

d=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.15) print $0}'  |wc -l `
e=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.25) print $0}'  |wc -l `
f=` cat /usr/local/coreseek/var/log/query.log.$zt | awk '{if ($6>0.35) print $0}'  |wc -l `

a1=` gawk -v x=$a -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `
#百分比处理。
b1=` gawk -v x=$b -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `
c1=` gawk -v x=$c -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `

d1=` gawk -v x=$d -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `
e1=` gawk -v x=$e -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `
f1=` gawk -v x=$f -v y=$zs 'BEGIN{printf "%.16f\n",x*100/y}' `

echo "coreseek's  low query  Percentage" >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.1s' Percentage $a1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.15s' Percentage $d1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.2s' Percentage $b1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.25s' Percentage $e1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.3s' Percentage $c1 >> coreseek.log
echo `date +%m%d%Y -d '-1 day' ` '>0.35s' Percentage $f1 >> coreseek.log

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载