異常終了@Wiki

性能情報収集関連シェル

最終更新:

匿名ユーザー

- view
メンバー限定 登録/ログイン
#!/bin/sh
nohup sar -A -o sar.out 5 36000 > sar.log 2>&1 &
nohup iostat -x 5 36000 > iostat.out 2>&1 &
nohup vmstat 5 36000 > vmstat.out 2>&1 &

sleep 3

ps -ef | grep sadc | grep -v grep
ps -ef | grep iostat | grep -v grep
ps -ef | grep vmstat | grep -v grep

s-1 性能情報収集
$ nohup sar -A -o sar.out 1 36000 > sar.log 2>&1
1秒間隔で36000秒(10時間)、CPU等情報を収集し、
sar.logファイルに出力する。

s-2  I/O統計情報収集
$ nohup iostat -x 1 36000 > iostat.out 2>&1 &
1秒間隔で36000秒(10時間)、
拡張デバイスのI/O使用率を収集し、
iostat.outファイルに出力する。

※nohupログアウトしてもプロセスが終了しないようにするコマンド


kill -TERM `ps -ef | grep sadc | grep -v grep | awk '{print $2}'`
kill -TERM `ps -ef | grep iostat | grep -v grep | awk '{print $2}'`
kill -TERM `ps -ef | grep vmstat | grep -v grep | awk '{print $2}'`

ps -ef | grep sadc | grep -v grep
ps -ef | grep iostat | grep -v grep
ps -ef | grep vmstat | grep -v grep

k-1 sadcプロセスの強制終了
$ kill -TERM `ps -ef | grep sadc | grep -v grep | awk '{print $2}'`
現在実行中のすべてのプロセスうち、sadcコマンドを実行中のプロセスを強制終了す る。

k-2 iostatプロセスの強制終了
$ kill -TERM `ps -ef | grep iostat | grep -v grep | awk '{print $2}'`
現在実行中のすべてのプロセスうち、iostatコマンドを実行中のプロセスを強制終了する。

※awk
テキスト整形ツール。{print $2}は2列目を表示を意味する。


#!/bin/sh

today=`date +%y%m%d`
if [ $# -lt 1 ]; then
  i=1
  cond=true
  while $cond
  do
  if [ -d test_${today}_$i ]; then
  i=`expr $i + 1`
  else
  cond=false;
  fi
  done
  dirname=test_${today}_$i
else
  dirname=test_${today}_$1
  if [ -d $dirname ]; then
  echo "$dirname already exist!!"
  exit 1
  fi
fi

OUTDIR=/psp/sdata/seinou/$dirname

mkdir $OUTDIR

sar -f sar.out > $OUTDIR/sar.txt
/bin/mv sar.out $OUTDIR
/bin/mv iostat.out $OUTDIR
/bin/mv vmstat.out $OUTDIR
/bin/mv *.lst $OUTDIR
/bin/mv gc_*.log $OUTDIR
/bin/mv stdout_*.log $OUTDIR

/bin/rm sar.log

ls udump/*.trc > tmptmptmp1
./mktkprof.pl < tmptmptmp1 > tmptmptmp2
. ./tmptmptmp2
/bin/mv udump/*.trc $OUTDIR
/bin/mv udump/*.prof $OUTDIR


m-1 sar出力ファイル名の変更
$ /bin/mv sar.out sar_TEST$1.out
sar.outからsar_TEST.outへファイル名を変更する。

m-2 iostat出力ファイル名の変更
$ /bin/mv iostat.out iostat_TEST$1.out
iostat.outからiostat_TEST.outへファイル名を変更する。
人気記事ランキング
目安箱バナー