a small hack
Article: 7941 of alt.hackers From: kim@mso.anu.edu.au Newsgroups: alt.hackers Subject: a small hack Date: 02 Jun 1995 21:43:57 +1000 Organization: Mount Stromlo and Siding Spring Observatories. Lines: 42 Approved: trent@NIN.com Message-ID: rhivqp0x36.fsf@magician.anu.edu.au NNTP-Posting-Host: 150.203.89.99 X-Newsreader: (ding) Gnus v0.79 Status: RO
Just a small (Ob)hack I performed today: Needed to collect some disk i/o stats for a bunch of workstations. Unfortunately the system supplied iostat command only printed out stuff like: extended disk statistics disk r/s w/s Kr/s Kw/s wait actv svc_t %w %b sd1 0.2 0.0 4.4 0.4 0.0 0.0 29.5 0 0 sd16 0.0 0.1 0.4 3.3 0.0 0.0 74.1 0 0 sd2 0.0 0.0 0.8 0.4 0.0 0.0 31.6 0 0 sd3 0.3 0.5 1.2 4.7 0.0 0.0 25.7 0 1 This is OK, but I need to average over a long time, so if a disk isnt particularly active, the kB read and write numbers might be only 0.1 or 0.2 - ie, very low precision, just one sig. fig. No sources available of course. Solution: 'strings iostat', find the printf string in the executable which looks like %-8.8s %4.1f %4.1f %6.1f %6.1f %4.1f %4.1f %6.1f %3.0f %3.0f copy the binary, edit the string to say %-8.8s %4.1f %4.1f %6.1f %6.1f %4.2f %4.2f %6.1f %3.0f %3.0f Now my new improved iostat says: extended disk statistics disk r/s w/s Kr/s Kw/s wait actv svc_t %w %b sd1 0.2 0.0 4.36 0.44 0.0 0.0 29.5 0 0 sd16 0.0 0.1 0.39 3.27 0.0 0.0 74.1 0 0 sd2 0.0 0.0 0.81 0.38 0.0 0.0 31.6 0 0 sd3 0.3 0.5 1.18 4.72 0.0 0.0 25.7 0 1 I was much happier. Kim. -- Kim Sebo Mount Stromlo and Siding Spring Observatories, A.N.U. Email: kim@mso.anu.edu.au or kms100@huxley.anu.edu.au Phone: Work: +61 6 249-0253