Created
June 29, 2018 15:49
-
-
Save douglascodes/b0ebe90d3e5f00704bcabf28f2ab75c7 to your computer and use it in GitHub Desktop.
Creates a log file for iostat data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# gather_hdd_stats.sh $(date +%F).log | |
# Every 5 seconds on the mod 5 pipe formatted iostat data to <file> | |
if [ $# -lt 1 ] ; then | |
echo "usage: $0 <file>" | |
exit -1 | |
fi | |
outputfile="$1" | |
export S_TIME_FORMAT=ISO; | |
sleep $(/bin/date +'%-S' | /usr/bin/env awk '{print 5 - int($1%5)}'); | |
while true; do | |
/usr/bin/iostat -t -d -H -g hdds sda sdb | /usr/bin/env awk -f /home/dhking/bin/clean_iostat.awk >> ${outputfile} | |
sleep $(/bin/date +'%-S' | /usr/bin/env awk '{print 5 - int($1%5)}'); | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment