As i had quite a fight with a larger IKEA PAX closet for my bedroom, i hadn’t quite the time to complete the ZFS retention article so far. Thus today a smaller feature again today, which makes my life a little bit easier from time to time.

When doing a performance analysis for customer i often use scripts to wade through megabyte worth of *stat data. Most often they transform data into a csv file more tailored to my needs than the default csv output in order to import it to R. That said, on iostat it’s sometimes not that easy to find the separation between two measurement samples. Of course often you can misuse the header line or the timestamp provided by -T d or -T u.

However iostat -epw 1 has a different header than iostat epwxXu1, leaving you only with a timestamp as a common separator or you have to modify your scripts to find the matching headerline for each output and the detection of the separation by timestamp has to be modified to detect timestamps of the locale the customer has used when he or she gathered the output.

A few years ago, it took me a moment to see that two iostats were done by two different people with differing locales and thus broke my script.

jmoekamp@testbed:~$ LANG=de iostat -x -T d
Freitag, 26. Juli 2024 um 08:52:19 Uhr CEST
                    extended device statistics
device     r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b
sd0       4,3   16,4  143,9  130,2  0,0  0,0    0,1    0,3   0   1
sd1       0,0    0,0    0,0    0,0  0,0  0,0    0,0    0,0   0   0 
sd2       0,1    0,1    0,8    0,4  0,0  0,0    0,0    0,3   0   0
sd3       0,0    0,1    0,7    0,4  0,0  0,0    0,0    0,2   0   0
jmoekamp@testbed:~$ LANG=C iostat -x -T d
Fri Jul 26 08:52:23 CEST 2024
                     extended device statistics
device     r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b
sd0       4.3   16.5  143.6  130.1  0.0  0.0    0.1    0.3   0   1
sd1       0.0    0.0    0.0    0.0  0.0  0.0    0.0    0.0   0   0
sd2       0.1    0.1    0.8    0.4  0.0  0.0    0.0    0.3   0   0
sd3       0.0    0.1    0.7    0.4  0.0  0.0    0.0    0.2   0   0

Of course separating the Samples by searching for Fri Jul wouldn’t cut it with a LANG=deoutput.

Situation got a little bit more elegant with SRU 60: You can now just use -S to separate the measurement samples.

jmoekamp@testbed:~$ iostat -Sx 1
                 extended device statistics
device     r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b
sd0       5,5   17,5  185,6  157,6  0,0  0,0    0,1    0,3   0   1
sd1       0,0    0,0    0,0    0,0  0,0  0,0    0,0    0,0   0   0
sd2       0,1    0,2    1,0    0,5  0,0  0,0    0,0    0,3   0   0
sd3       0,0    0,2    1,0    0,5  0,0  0,0    0,0    0,2   0   0
---
                 extended device statistics
device     r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b
sd0       0,0    0,0    0,0    0,0  0,0  0,0    0,0    0,0   0   0
sd1       0,0    0,0    0,0    0,0  0,0  0,0    0,0    0,0   0   0
sd2       0,0    0,0    0,0    0,0  0,0  0,0    0,0    0,0   0   0
sd3       0,0    0,0    0,0    0,0  0,0  0,0    0,0    0,0   0   0
---

Using -S the iostat samples will simply be separated with a ---. Much less error prone to parse.

Written by

Joerg Moellenkamp

Grey-haired, sometimes grey-bearded Windows dismissing Unix guy.