#!/bin/sh ############################################################################### # iops.sh lists all physical volumes in the system sorted by IOPS, so you can # identify who is the most demanding disk/s device. It also shows Physical# # volume name, Volume group name and mounted file systems belonging to that # volume group. # # It is an excellent tool for troubleshooting Disk and file system over-loads. # # It also shows the system total IOPS. # Enjoy! # Pablo Arnaldi # # Updates for HP-UX 11.31 agile view disks - Dusan Baljevic ############################################################################### PATH=/usr/bin:/usr/sbin:/sbin; export PATH OS=$(uname -s) SARDIR="/var/adm/sa" TEMP1="/tmp/raw-sar-output.txt$$" TEMP2="/tmp/sorted-sar-output.txt$$" if [ $OS != "HP-UX" ] then echo "Sorry, must run on HP-UX using LVM" exit 1 else CONT=0 SAR=$(sar -d 2>/dev/null) # if [ ! -d "$SARDIR" -o ! "$SAR" ] # then # echo "Sorry, it looks like Unix system accounting is not enabled" # exit 1 # fi echo "Collecting sar info. Please wait..." sar -d 4 10 > $TEMP1 cat $TEMP1 | awk '/^Average/ { print $5,$2 }' | sort -k 1n,1 > $TEMP2 if [ -s "$TEMP2" ] then cat $TEMP2 | while read file do IO=$(echo $file | awk '{ print $1 }') let CONT=CONT+`echo $file | awk '{ print $1 }'` PV=$(echo $file | awk '{ print $2 }') echo "-------------------------------------" printf "IO rate = %0.2f IOPS \n" $IO echo "PV = $PV" done echo "=====================================" TOTIOPS=$(echo $CONT) echo " CURRENT TOTAL $TOTIOPS IOPS " echo " `date` " echo " `uname -n` " echo "=====================================" else echo "Sorry, it looks like Unix system accounting is not enabled" rm -f $TEMP1 $TEMP2 2>/dev/null exit 1 fi fi rm -f $TEMP1 $TEMP2 2>/dev/null exit 0