Feature #8083
opensar(1) should print a timestamp in each output line when reporting disk stats
70%
Description
When reporting disk stats with -d, sar only prefixes the first device with a timestamp. This makes it complicated to grep for specific times or specific disks, it also changes the number of columns, so (n)awk get confused:
(609) oldn90700:/home/olbohlen$ sar -d 1 1 SunOS oldn90700 5.11 illumos-585f422 i86pc 04/19/2017 08:38:00 device %busy avque r+w/s blks/s avwait avserv 08:38:01 blkdev0 0 0.0 0 0 0.0 0.0 sd1 0 0.0 0 0 0.0 0.0 sd1,a 0 0.0 0 0 0.0 0.0 sd1,c 0 0.0 0 0 0.0 0.0 sd1,i 0 0.0 0 0 0.0 0.0 sd1,q 0 0.0 0 0 0.0 0.0 sd1,r 0 0.0 0 0 0.0 0.0 sd2 0 0.0 0 0 0.0 5.6 sd2,a 0 0.0 0 0 0.0 5.6 sd2,h 0 0.0 0 0 0.0 0.0 sd2,i 0 0.0 0 0 0.0 0.0 sd2,q 0 0.0 0 0 0.0 0.0 sd3 0 0.0 0 0 0.0 0.0 ehci0,bu 0 0.0 0 0 0.0 0.0 ehci0,ct 0 0.0 0 0 0.0 0.0 ehci0,in 0 0.0 0 0 0.0 0.0 ehci0,is 0 0.0 0 0 0.0 0.0 ehci0,to 0 0.0 0 0 0.0 0.0 ehci1,bu 0 0.0 0 0 0.0 0.0 ehci1,ct 0 0.0 0 0 0.0 0.0 ehci1,in 0 0.0 0 0 0.0 0.0 ehci1,is 0 0.0 0 0 0.0 0.0 ehci1,to 0 0.0 0 0 0.0 0.0 datapool 1 0.0 1 31 0.0 11.2 extpool 0 0.0 0 0 0.0 0.0 rpool 0 0.0 0 0 0.0 0.0
vs.
(615) oldn90700:/home/olbohlen/git/illumos-gate/usr/src/cmd/sa$ ./sarnew -d 1 1 SunOS oldn90700 5.11 illumos-585f422 i86pc 04/19/2017 08:39:40 device %busy avque r+w/s blks/s avwait avserv 08:39:41 blkdev0 0 0.0 0 0 0.0 0.0 08:39:41 sd1 0 0.0 0 1 0.0 0.1 08:39:41 sd1,a 0 0.0 0 1 0.0 0.1 08:39:41 sd1,c 0 0.0 0 0 0.0 0.0 08:39:41 sd1,i 0 0.0 0 0 0.0 0.0 08:39:41 sd1,q 0 0.0 0 0 0.0 0.0 08:39:41 sd1,r 0 0.0 0 0 0.0 0.0 08:39:41 sd2 0 0.0 0 0 0.0 0.0 08:39:41 sd2,a 0 0.0 0 0 0.0 0.0 08:39:41 sd2,h 0 0.0 0 0 0.0 0.0 08:39:41 sd2,i 0 0.0 0 0 0.0 0.0 08:39:41 sd2,q 0 0.0 0 0 0.0 0.0 08:39:41 sd3 0 0.0 0 0 0.0 0.0 08:39:41 ehci0,bu 0 0.0 0 0 0.0 0.0 08:39:41 ehci0,ct 0 0.0 0 0 0.0 0.0 08:39:41 ehci0,in 0 0.0 0 0 0.0 0.0 08:39:41 ehci0,is 0 0.0 0 0 0.0 0.0 08:39:41 ehci0,to 0 0.0 0 0 0.0 0.0 08:39:41 ehci1,bu 0 0.0 0 0 0.0 0.0 08:39:41 ehci1,ct 0 0.0 0 0 0.0 0.0 08:39:41 ehci1,in 0 0.0 0 0 0.0 0.0 08:39:41 ehci1,is 0 0.0 0 0 0.0 0.0 08:39:41 ehci1,to 0 0.0 0 0 0.0 0.0 08:39:41 datapool 0 0.0 0 0 0.0 0.0 08:39:41 extpool 0 0.0 0 0 0.0 0.0 08:39:41 rpool 0 0.0 0 1 0.7 0.1
Updated by Joshua M. Clulow over 5 years ago
I'm not sure that we can just change the output of a long-standing utility like sar(1)
, lest we break existing scripts. If you want it to be easier to parse the output, perhaps consider adding a parsable output mode under a new flag?
Updated by Olaf Bohlen over 5 years ago
Joshua Clulow wrote:
I'm not sure that we can just change the output of a long-standing utility like
sar(1)
, lest we break existing scripts. If you want it to be easier to parse the output, perhaps consider adding a parsable output mode under a new flag?
Indeed, I plan to implement a new switch -D, which will bring the new output. I just included the output above from my early testings.