2011年4月1日 星期五

收集系統information

#觀察系統一般參數
RH20 /home/cts>cat report1.sh
#!/bin/bash
LOG=~/report1.log
date > $LOG
echo "" >> $LOG
echo "=========================df==============================" >> $LOG
df >> $LOG
echo "" >> $LOG
echo "======================blockdev===========================" >> $LOG
blockdev --report /dev/sda >> $LOG
echo "" >> $LOG
echo "======================grub.conf==========================" >> $LOG
cat /etc/grub.conf >> $LOG
echo "" >> $LOG
echo "======================lsb_release========================" >> $LOG
lsb_release -a >> $LOG
echo "" >> $LOG
echo "=======================uname=============================" >> $LOG
uname -a >> $LOG
echo "" >> $LOG
echo "======================meminfo============================" >> $LOG
cat /proc/meminfo >> $LOG
echo "" >> $LOG
echo "======================cpuinfo============================" >> $LOG
cat /proc/cpuinfo >> $LOG
echo "" >> $LOG
echo "======================iostat=============================" >> $LOG
iostat -x >> $LOG
echo "" >> $LOG
echo "======================vmstat=============================" >> $LOG
vmstat -m >> $LOG
echo "" >> $LOG
vmstat -a >> $LOG
echo "" >> $LOG
vmstat -n >> $LOG
echo "" >> $LOG
vmstat -s >> $LOG
echo "" >> $LOG
vmstat -d >> $LOG

echo "" >> $LOG
echo "======================sysctl=============================" >> $LOG
sysctl -a | grep -e lowmem -e pressure -e page-cluster -e zone >> $LOG

#觀察系統io參數
RH20 /home/cts>cat report2.sh
#!/bin/bash
LOG=~/report2.log
date > $LOG
echo "" >> $LOG
echo "======================scheduler==========================" >> $LOG
cat /sys/block/sda/queue/scheduler >> $LOG
echo "" >> $LOG
echo "====================read_ahead_kb========================" >> $LOG
cat /sys/block/sda/queue/read_ahead_kb >> $LOG
echo "" >> $LOG
echo "====================nr_requests==========================" >> $LOG
cat /sys/block/sda/queue/nr_requests >> $LOG
echo "" >> $LOG
echo "===================antic_expire==========================" >> $LOG
cat /sys/block/sda/queue/iosched/antic_expire >> $LOG
echo "" >> $LOG
echo "===================read_expire===========================" >> $LOG
cat /sys/block/sda/queue/iosched/read_expire >> $LOG
echo "" >> $LOG
echo "===================write_expire==========================" >> $LOG
cat /sys/block/sda/queue/iosched/write_expire >> $LOG
echo "" >> $LOG
echo "=====================quantum=============================" >> $LOG
cat /sys/block/sda/queue/iosched/quantum >> $LOG
echo "" >> $LOG
echo "=====================queue===============================" >> $LOG
cat /sys/block/sda/queue/iosched/queue >> $LOG
echo "" >> $LOG
echo "=================front_merges============================" >> $LOG
cat /sys/block/sda/queue/iosched/front_merges >> $LOG
for pidd in $(pidof XGateway)
do
echo "" >> $LOG
top -n 1 -S -b -p $pidd >> $LOG
echo "" >> $LOG
ps -p $pidd -o comm,cmd,user,group >> $LOG
done

echo "" >> $LOG
top -S -b -n1 >> $LOG

#觀察2天的file fragmentation
RH20 /home/cts>cat report3.sh
#!/bin/bash
LOG=~/report3.log
date1="20110317"
date2="20110324"
date > $LOG
echo "" >> $LOG
echo "=========================KGIStkLog==============================" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KGIStkLog/10.0.250.24.Ord >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KGIStkLog/10.0.250.24.Ord >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KGIStkLog/10.0.250.24.Rpt >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KGIStkLog/10.0.250.24.Rpt >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KGIStkLog/10.0.250.24.RptOth >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KGIStkLog/10.0.250.24.RptOth >> $LOG
echo "" >> $LOG

echo "" >> $LOG
echo "=========================KStkSesLog=============================" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KStkSesLog/192.168.248.92.Ord >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KStkSesLog/192.168.248.92.Ord >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KStkSesLog/192.168.248.93.Ord >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KStkSesLog/192.168.248.93.Ord >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KStkSesLog/192.168.248.93.PreRpt >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KStkSesLog/192.168.248.93.PreRpt >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KStkSesLog/192.168.248.93.Rpt >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KStkSesLog/192.168.248.93.Rpt >> $LOG
echo "" >> $LOG

echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KStkSesLog/All.inn >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KStkSesLog/All.inn >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/KStkSesLog/All.preinn >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/KStkSesLog/All.preinn >> $LOG
echo "" >> $LOG

echo "" >> $LOG
echo "=========================orderlog===============================" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/orderlog/IvacMatch.rec >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/orderlog/IvacMatch.rec >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/orderlog/IvacOrder.rec >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/orderlog/IvacOrder.rec >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/orderlog/LocalIvacMatch.rec >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/orderlog/LocalIvacMatch.rec >> $LOG
echo "" >> $LOG

echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/orderlog/IvacStkLocalMat/0000 >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/orderlog/IvacStkLocalMat/0000 >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/orderlog/IvacStkLocalOrd/0000 >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/orderlog/IvacStkLocalOrd/0000 >> $LOG
echo "" >> $LOG
echo "" >> $LOG
echo "=========================OrderLog===============================" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/OrderLog/Stk/Deals.bin >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/OrderLog/Stk/Deals.bin >> $LOG
echo "" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/OrderLog/Stk/SysOrds.inn >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/OrderLog/Stk/SysOrds.inn >> $LOG
echo "" >> $LOG

echo "" >> $LOG
echo "=========================SyncLog================================" >> $LOG
echo "$date1" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date1/SyncLog/Stk.Sync >> $LOG
echo "$date2" >> $LOG
/usr/sbin/filefrag -v /xgw/XGW.Stk.K1/Logs/$date2/SyncLog/Stk.Sync >> $LOG
echo "" >> $LOG

沒有留言:

張貼留言

文章分類