#!/bin/sh
WORKDIR=/usr/local/nginx/logs
STATUSKEY="vs"
DISPCOUNT=5
LOGCOUNT=5000
cd $WORKDIR
DATE_STR=`date -d today +"%Y-%m-%d"`
if [ $# -eq 1 ]
then
DATE_STR=$1
#echo $DAY_STR
#exit
fi
#echo $DATE_STR
date
#并发量
echo "并发量"
tail -$LOGCOUNT access.log|awk '{print $4}'|awk 'BEGIN {FS="[:]"} {print $2":"$3":"$4}'|sort |uniq -c |awk '{print $1}'|sort -k 1 |uniq -c
echo " ************** "
#响应状态
echo "响应状态"
tail -$LOGCOUNT access.log|grep $STATUSKEY |awk '{print $9}'|sort |uniq -c
echo " ************** "
#最近5条访问
echo ‘最近$DISPCOUNT条访问’
tail -$DISPCOUNT access.log
#系统连接数
echo "系统连接数"
netstat -an|grep tcp |wc -l
echo " ************** "
#系统连接情况
echo "系统连接情况"
netstat -an|grep tcp|awk '{print $NF}'|sort|uniq -c
echo " ************** "
#系统数据库连接情况
echo "系统数据库连接情况"
netstat -an|grep ":1433"|awk -F "::ffff:" '{printf("%20s %30s/r/n", $2,$3)}'
echo " ************** "
#系统硬盘使用情况
echo "系统硬盘使用情况"
df -h |grep dev|awk '{printf ("%20s %10s %10s/r/n", $NF,$(NF-1),$(NF-2))}'
echo " ************** "
#系统负载情况
echo "系统负载情况"
w
echo " ************** "