Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Awk script to convert collectl output into an iostat format.
- #
- # Requirements:
- # Your collectl output is generated via the command:
- # /usr/bin/collectl --playback (your files) --subsys cD -oT -P -f (output files)
- #
- # Then you take the output and sort it to put together the CPU and disk output:
- # gunzip -c (output files) | sort > intermediate_file
- #
- # Feed intermediate_file to this script and it will produce iostat output in the format:
- # avg-cpu: %user %nice %system %iowait %steal %idle
- # 0.08 0.01 0.10 0.02 0.00 99.79
- #
- # Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
- # sda 0.01 3.38 0.06 0.28 0.77 14.67 89.72 0.00 6.62 0.27 0.01
- # sda1 0.00 0.00 0.00 0.00 0.00 0.00 7.99 0.00 0.65 0.63 0.00
- # sda2 0.01 3.38 0.06 0.28 0.76 14.67 89.77 0.00 6.62 0.27 0.01
- #
- #
- BEGIN { FS = " " }
- # CPU records have 21 fields.
- NF == 21 {
- printf("\navg-cpu: %%user %%nice %%system %%iowait %%steal %%idle\n");
- printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f\n\n", $3, $4, $5+$7+$8, $6, $9, $10 )
- }
- # DISK records may have hundreds of fields
- NF > 21 {
- # Print the header for the disk report
- printf("Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %%util\n");
- # Read this line into an array
- disks = split($0,diskstat," ")
- # Loop through the array for disk data. Skip the first 2 items (date & time) and print a return after each row.
- for ( stat = 3; stat <= disks; stat = stat+12 )
- printf("%-13s %8.2f %8.2f %7.2f %7.2f %8.2f %8.2f %8.2f %8.2f %7.2f %6.2f %6.2f\n", diskstat[stat], diskstat[stat+2], diskstat[stat+5], diskstat[stat+1], diskstat[stat+4], diskstat[stat+3], diskstat[stat+6], diskstat[stat+7], diskstat[stat+8], diskstat[stat+9], diskstat[stat+10], diskstat[stat+11] )
- }
- END { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement