Linux under Disk Monitoring script

Source: Internet
Author: User

September stole a lazy, make up an article


Note: Shell scripts require FIO tools to monitor disk read and write performance in real time

#!/bin/bashdate=$ (date +%m-%d) iostatlog=/var/log/iostat${date}.logfiolog=/var/log/fio${date}.log/bin/ps  -ef |grep  "Iostat -dk 5"  | grep -v grep > /dev/ nullif [ $? == 0 ]thenecho  "Disk monitor already running" exit  1else/usr/bin/iostat -dk 5 >> $IOSTATLOG  &pid=$!fiwhile truedoecho  -------------' Date '-------->> $FIOLOGecho  --------------fio test--------------------- >> $FIOLOG ##### #随机读:echo  "-------------Random read S----------------" >> $FIOLOGfio  -filename=/dev/ sda1 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=4k  -size=4096m -numjobs=10 -runtime=1000 -group_reporting -name=mytest >> $FIOLOG  2>&1fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw= Randread -ioengine=psync -bs=128k -size=4096m -numjobs=10 -runtime=1000 -group_reporting -name=mytest   >> $FIOLOG  2>&1fio -filename=/dev/sda1 -direct=1 -iodepth 1 - thread -rw=randread -ioengine=psync -bs=1m -size=4096m -numjobs=10 -runtime=1000  -group_reporting -name=mytest  >> $FIOLOG  2>&1#### #顺序读:echo  "------ -------Sequential Read----------------">> $FIOLOGfio  -filename=/dev/sda1 -direct=1 -iodepth 1  -thread -rw=read -ioengine=psync -bs=4k -size=4096m -numjobs=30 -runtime= 1000 -group_reporting -name=mytest  >> $FIOLOG  2>&1fio -filename=/ dev/sda1 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=128k  -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest  > > $FIOLOG  2>&AMp;1fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=read -ioengine =psync -bs=1m -size=4096m -numjobs=30 -runtime=1000 -group_reporting -name= mytest  >> $FIOLOG  2>&1#### #随机写:echo  "-------------random write----------------" > > $FIOLOGfio  -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randwrite  -ioengine=psync -bs=4k -size=4096m -numjobs=30 -runtime=1000 -group_reporting  -name=mytest  >> $FIOLOG  2>&1fio -filename=/dev/sda1 -direct=1  -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=128k -size=4096m  -numjobs=30 -runtime=1000 -group_reporting -name=mytest  >> $FIOLOG  2 >&1fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randwrite  -ioengine=psync -bs=1m -size=4096m -numjobs=30 -runtime=1000 -group_reporting -name=mytest  >>$ fiolog 2>&1#### #顺序写:echo  "-------------sequential write----------------" >> $FIOLOGfio  -filename= /dev/sda1 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=4k  -size=4096M -numjobs=30 -runtime=1000 -group_reporting -name=mytest  > > $FIOLOG  2>&1fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread  -rw=write -ioengine=psync -bs=128k -size=4096m -numjobs=30 -runtime=1000 - Group_reporting -name=mytest  >> $FIOLOG  2>&1fio -filename=/dev/sda1  -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=1m -size= 4096m -numjobs=30 -runtime=1000 -group_reporting -name=mytest  >> $FIOLOG  2>&1#### #混合随机读写:echo  "-------------mixed random Read and write----------------" >> $FIOLOG ###### #4kfio  -filename=/dev/sda1 - direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=4k  -size=4096m -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler =noop  >> $FIOLOG  2>&1###### #128kfio  -filename=/dev/sda1 -direct=1 - Iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=128k -size= 4096m -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop   >> $FIOLOG  2>&1###### #1Mfio  -filename=/dev/sda1 -direct=1 -iodepth  1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=1m -size=4096m - Numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop  > > $FIOLOG  2>&1sleep 60done 


This article is from the "Danielqu" blog, make sure to keep this source http://qujunorz.blog.51cto.com/6378776/1859968

Linux under Disk Monitoring script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.