Operating System - HP-UX
1753325 Members
5746 Online
108792 Solutions
New Discussion

total I/O by disk over time

 
klb
Valued Contributor

total I/O by disk over time



My first stab at it using iostat...

#!/usr/bin/ksh

#
# The interval must be 1 second, otherwise results are useless
iostat 1 | awk 'BEGIN {
iter_count = 0
report_interval = 600
num_disks = 0
init_started = 0
init = 1
}
{
if ( init == 1 && $1 !~ "^$" && $1 !~ "device" ) {
init_started = 1;
dio[$1] = 0;
dnm[num_disks] = $1;
num_disks++;
continue;
}

if ( init_started == 1 && $1 ~ "^$" ) {
# Display and clear the arrays every report_interval
if ( iter_count >= report_interval ) {
system("date");
printf("%-15s %12s ( interval: %d seconds )\n\n",
"device","MBytes", report_interval);
for ( i=0; i < num_disks; i++ ) {
printf("%-12s %12d\n",dnm[i], dio[dnm[i]]/1024);
dio[dnm[i]] = 0;
}
printf("\n");
system(""); # force awk to flush its output buffer
iter_count=0;
}
else
iter_count++;
init=0;
continue;
}
# Capture the interval's I/O for this disk
dio[$1] = dio[$1] + $2;
}'

Testing with report_interval set to 5 seconds and generating a known amount of I/O appeared to report correct totals ( write ).

-klb
1 REPLY 1
Emil Velez
Honored Contributor

Re: total I/O by disk over time

Many times systems have measureware loaded on them. Using the extract command you can get the 5 minute I/O totals and 1 hour summaries.

In addition it will collect data per disk, lv, filesystem and you can get the 5 minute data and 1 hour data.

If you do not have the enterprise or MC oe and it includes measureware. You could consider loading it and it will be fully functional once for 60 days. You can do alot of analysis of your system for 60 days.

It collects about 400 performance metrics on your system.