/* 설명
1. percona-toolkit 설치 (apt-get install percona-toolkit)
2. gnuplot 설치 (apt-get install gnuplot 또는 wget percona.com/get/pt-diskstats) -- 설치가 제대로 안될시에 apt-get update
3. /root/iops_check 폴더 생성
4. ioplot.sh, diskstats.sh 파일 생성
5. crontab 등록
-- 참고 driver별 iops 측정 : http://www.wmarow.com/strcalc/
*/
===== ioplot.sh 파일======
#!/bin/sh
if [ $# -ne 1 ]; then
echo "Usage: $0 filename"
exit 1
fi
gnuplot <<EOF
set term pngcairo size 1024, 768
set out "\/root\/iops_check\/diskstats$(date +\%y\%m\%d\%H\%M\%S).png"
set title "pt-diskstats"
set xdata time
set timefmt "%H:%M:%S"
set xlabel "Time (`date +%y/%m/%d`)"
set ylabel "IOPS per second"
set format x "%H:%M"
plot "$1" using 1:3 title "r/s" with lines lc rgb "blue", "$1" using 1:6 title "w/s" with lines lc rgb "red", "$1" using 1:10 title "io/s" with lines lc rgb "green"
EOF
===========================================================================================================================================================
/* 설명
set term pngcairo size 1024, 768 -- 이미지 해상도
set out "diskstats`date +%y%m%d%H%M%S`.png -- 이미지로 나오는 파일명
set title "pt-diskstats" -- 이미지 내 타이블
set xdata time -- 시간
set timefmt "%H:%M:%S" -- 시간포멧
set xlabel "Time (`date + %y%m%d`)" -- x 축 이름
set ylabel "IOPS per second" -- y 축 이름
set format x "%H:%M" -- x 축 포멧
plot "$1" using 1:3 title "r/s" with lines lc rgb "blue", "$1" using 1:6 title "w/s" with lines lc rgb "red", "$1" using 1:10 title "io/s" with lines lc rgb "green" -- 보여줄 필드명, 색깔지정
"$1" using 1:3 title "r/s" with lines lc rgb "blue" 형식으로 계속 필드 추가할 수 있으며
1:3은 /usr/bin/pt-diskstats --devices-regex=xvdb1 --interval=1 --iterations=1 --show-timestamps --columns 'rd_s|rd_rt|rd_cnc|wr_s|wr_rt|wr_cnc|busy|io_s'|grep -v '# 실행 시
실제 보여지는 행과 필드의 순서임. 1 행 3번 필드, 1행 6번 필드..이런 형식
*/
===== diskstats.sh =====
#!/bin/sh
/usr/bin/pt-diskstats --interval=1 --iterations=1 --show-timestamps --columns 'rd_s|rd_rt|rd_cnc|wr_s|wr_rt|wr_cnc|busy|io_s'|grep -v '#' >> /root/iops_check/diskstats$(date +\%y\%m\%d).out
/* 설명
--devices-regex=xvdb1 -- device명
--interval=1 -- 1초간격
--iterations=20 -- 반복횟수
--columns 'rd_s|rd_rt|rd_cnc|wr_s|wr_rt|wr_cnc|busy|io_s' -- 칼럼추가
*/
===========================================================================================================================================================
===== crontab =====
-- 데이터 생성 및 추가(날짜별)
* * * * * /root/iops_check/diskstats.sh
-- 이미지 생성
59 23 * * * /root/iops_check/ioplot.sh /root/iops_check/diskstats$(date +\%y\%m\%d).out
===========================================================================================================================================================
'연구개발 > Linux' 카테고리의 다른 글
cacti 설치 (0) | 2014.12.04 |
---|---|
mysql 부팅 시 자동실행 중지 (0) | 2014.12.04 |
리눅스의 실제 메모리 사용량 보기 (0) | 2014.11.27 |
RSYNC 사용법 (0) | 2014.11.26 |
Disk IO 사용률 (0) | 2014.11.25 |