Specifications
Analyze Collected Detailed Rate of Change Data
msg "\n";
msg "This utility takes a /proc/diskstats output file that contains\n";
msg "output, logged over time, and calculates the rate of change of\n";
msg "the disks in the dataset\n";
msg "OUTPUT_CSV=1 set in env. dumps the full stats to a CSV file on
STDERR\n";
msg "\n";
msg "Example: $0 1hour \"jun 23 12pm\" steeleye-iostat.txt sdg,sdh\n";
msg "\n";
msg "interval - interval between samples\n";
msg "start time - the time when the sampling starts\n";
msg "iostat-data-file - collect this with a cron job like:\n";
msg "\t0 * * * * (date ; cat /proc/diskstats) >> /root/diskstats.txt\n";
msg "dev-list - list of disks you want ROC for (leave blank for all)\n";
exit 1;
}
usage if (@ARGV < 3);
my $interval = TimeHuman($ARGV[0]);
my $starttime = epoch($ARGV[1]);
my $file = $ARGV[2];
my $blksize = 512; # /proc/diskstats is in sectors
my %devs = map {$_ => 1 } split /,/, $ARGV[3];
my %stat;
my $firsttime;
my $lasttime;
# datestamp divides output
my %days = ('Sun' => 1, 'Mon' => 1, 'Tue' => 1, 'Wed' => 1,
'Thu' => 1, 'Fri' => 1, 'Sat' => 1);
my %fields = ('major' => 0,
'minor' => 1,
'dev' => 2,
'reads' => 3,
'reads_merged' => 4,
'sectors_read' => 5,
'ms_time_reading' => 6,
'writes' => 7,
'writes_merged' => 8,
'sectors_written' => 9,
'ms_time_writing' => 10,
270Installation and Configuration