export format for iostat available?

  • Michael Jordan
    Michael Jordan


    I'm trying to produce iostat style output for a vendor that can't seem to interpret the plot format. Has anyone already implemented an output format? My PERL skills are not going to get this done in the short amount of time I have to complete it.

    I will gladly offer beer/wine/beverage of choice in exchange for a helping hand on this. :-)

    The expected output format for each sample is below.

    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

    Take care,

  • Michael Jordan
    Michael Jordan


    As I read more in the docs about the export function, it appears I can't use it in playback with data I've already collected.

    Can anyone confirm that I have to use my custom export function in the original call to collect in record mode in order to get my iostat style output?

    If the above is true, is there any way to take the data I have collected already and munge it into an iostat format on the output?


  • Mark Seger
    Mark Seger

    A couple of things:

    - first and foremost you definitely CAN playback data via export.  Have you ever tried -export vmstat?  that's the whole point of export
    - as for iostat format while collectl reports the exact same columns of data (iostat was my inspiration), I made a conscious decision to leave off the fractions as I thought they took up too much room on the screen and got in the way.  I also decided to report KB instead of sectors, but other than that the format is quite simple.  All you need to is grab the code for printing disk data, copy/paste it into something else and chop it up.  As for including CPU data, same thing but, have you tried this:

    segerm@az1-devclient-0000:~$ collectl -scD
    waiting for 1 second sample…

    ### RECORD    1 >>> az1-devclient-0000 <<< (1332225886.001) (Tue Mar 20 06:44:46 2012) ###

    # User  Nice   Sys  Wait   IRQ  Soft Steal  Idle  CPUs  Intr  Ctxsw  Proc  RunQ   Run   Avg1  Avg5 Avg15 RunT BlkT
         1     0     0     0     0     0     0    98    24   476    428    18   229     0   0.00  0.05  0.05    0    0

    # DISK STATISTICS (/sec)
    #          <------reads------><------writes------><-----averages-----> Pct
    #Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
    sda              0      0    0    0       0      0    0    0       0     0     0      0    0
    dm-0             0      0    0    0       0      0    0    0       0     0     0      0    0
    dm-1             0      0    0    0       0      0    0    0       0     0     0      0    0

    while not identical, it's close ;)

    one other decision I made was not to report data for individual partitions.  At the time I wrote collectl the focus was HPC and partition performance was pretty uninteresting.  I'd claim it still is as you rarely write to 2 different partitions on the same disk as the same time.  Therefore just looking at the whole disk really does paint and accurate picture of what's going on.


  • Michael Jordan
    Michael Jordan


    Thanks very much for this! I really appreciate your quick response.

    The vendor in question has some script that they use and if the format isn't exactly like iostat, the script breaks. Apparently they don't have resources to make adjustments for other data sets.

    I did come up with a solution that you are free to share with others, but I didn't solve it with the export function (my PERL is not that strong). It's an awk script that is fed from collect to output the exact iostat format. I put the code on PasteBin for easy referral by anyone who might find it useful.

    It seemed logical that I could -export with -playback, but I got an error when I tried to do that with V3.6.0-3. However, my shell history is lost so I don't have the exact command or I'd reproduce it and we could figure it out.

    Also, I agree with the decision to leave out partitions. I'm just looking to size my overall storage I/O and utilization, so partitions, would just make more data that I have to combine.

    Take care and thanks again!