The "run diskstats" function invokes iostat with only the -d option, which causes iostat to only show the I/O utilization averaged over the uptime of the machine. The -w option must be used in order to get the I/O utilization averaged over the specified period. We'll likely want to change the script to run iostat -d -w 5 and add some logic to suppress the I/O utilization averaged over the uptime of the machine.
The first statistics that are printed are averaged over the system uptime. To get information about the current activity, a suitable wait time should be specified, so that the subsequent sets of printed statistics will be averaged over that time.