Operating System - HP-UX
1826510 Members
3093 Online
109694 Solutions
New Discussion

Re: Can you retrieve sar data for one disk device?

 
SOLVED
Go to solution
Geoff Wild
Honored Contributor

Can you retrieve sar data for one disk device?

Is there a way on the command line to do this? I checked man, doesn't look like it...

I'm currently running something like:

sar -d -s 00:00 -e 04:00 -f /var/adm/sa/sa26

but I have 264 devices!!! - and it is a pain to manually go through the data to look at one disk...

Yes, I can awk/grep - but I also need the time stamp....which is only displayed on the first disk of that period...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
12 REPLIES 12
James R. Ferguson
Acclaimed Contributor

Re: Can you retrieve sar data for one disk device?

Hi Geoff:

How about:

# perl -lne 'if (m/(\d\d:\d\d:\d\d)/) {$t=$1};if (m/DEVICE/) {print $t,$_}' /var/adm/sa/sa26

Modify DEVICE to match your disk of interest.

Regards!

...JRF...
baiju_3
Esteemed Contributor

Re: Can you retrieve sar data for one disk device?

Hi Geoff,

Can iostat be used to get the information ?.


Regards,
bl.



Good things Just Got better (Plz,not stolen from advertisement -:) )
Geoff Wild
Honored Contributor

Re: Can you retrieve sar data for one disk device?

James...

Doesn't seem to grab anything:

perl -lne 'if (m/(\d\d:\d\d:\d\d)/) {$t=$1};if (m/c62t0d2/) {print $t,$_}' /var/adm/sa/sa20

returns blank...

But it is there:

sar -d -s 00:00 -e 04:00 -f /var/adm/sa/sa20 |grep c62t0d2
c62t0d2 1.79 0.50 13 526 4.98 1.71
c62t0d2 1.66 0.50 11 464 5.12 1.82
c62t0d2 1.39 0.50 10 412 5.04 1.74
c62t0d2 0.66 0.50 9 274 5.13 0.73
c62t0d2 1.44 0.50 10 432 5.02 1.82
c62t0d2 1.25 0.50 8 361 4.95 1.87
c62t0d2 1.65 0.50 8 373 5.04 2.78
c62t0d2 0.77 0.50 3 337 4.96 2.89
c62t0d2 0.56 0.50 1 126 5.11 4.18
c62t0d2 1.52 0.50 5 252 5.00 4.42
c62t0d2 0.90 0.50 5 162 5.07 1.94
c62t0d2 1.60 0.50 7 309 5.03 2.98
c62t0d2 0.51 0.50 4 149 5.00 1.32
c62t0d2 1.64 0.50 7 377 5.01 3.06
c62t0d2 1.00 0.50 5 270 5.07 2.48
c62t0d2 3.09 0.50 17 769 5.07 2.28
c62t0d2 2.39 0.50 15 634 5.01 1.82
c62t0d2 2.77 0.50 15 686 4.98 2.40
c62t0d2 1.63 0.50 8 468 4.97 2.28
c62t0d2 1.13 0.50 5 288 4.97 2.65
c62t0d2 0.40 0.50 5 150 5.03 0.78
c62t0d2 0.55 0.50 7 195 5.06 0.77
c62t0d2 0.80 0.50 6 256 4.98 1.75
Average c62t0d2 1.30 0.50 8 345 5.02 2.06


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Steven E. Protter
Exalted Contributor

Re: Can you retrieve sar data for one disk device?

Shalom Geoff

I'd reccommend this:
http://www.hpux.ws/system.perf.sh

But!!!!

Before looking at the disk stuff, grep it.

It would be easy enough to actually modify the above programs to monitor only certain devices, but I'd like to have the data and fileter it after the fact.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Geoff Wild
Honored Contributor

Re: Can you retrieve sar data for one disk device?

Steven - is your site down or is it just me?

http://www.hpux.ws/

Cannot find server or DNS Error

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Hein van den Heuvel
Honored Contributor

Re: Can you retrieve sar data for one disk device?

Hey Geoff,

Hope you are well. Orlando seems a long time ago.

Anyway,

Check out the following prior discussion:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=988904

It seems to solve much similar problems.

Regards,

Hein.
James R. Ferguson
Acclaimed Contributor

Re: Can you retrieve sar data for one disk device?

Hi Geoff:

Well, could you post a snippet of your output?

It works for me when doing:

# sar -d 5 5||perl -lne 'if (m/(\d\d:\d\d:\d\d)/) {$t=$1};if (m/cXtYdZ/) {print $t,$_}'

Regards!

...JRF...
Geoff Wild
Honored Contributor

Re: Can you retrieve sar data for one disk device?

James,

did you mean two pipes from sar?

sar -d 5 5||perl -lne 'if (m/(\d\d:\d\d:\d\d)/) {$t=$1};if (m/c62t0d2/) {print $t,$_}'

Returns everything...

Or one:

sar -d 5 5|perl -lne 'if (m/(\d\d:\d\d:\d\d)/) {$t=$1};if (m/c62t0d2/) {print $t,$_}'
10:53:08 c62t0d2 0.20 0.50 4 141 5.34 0.57
10:53:18 c62t0d2 0.20 0.50 5 128 3.55 0.48
10:53:23 c62t0d2 0.20 0.50 2 61 6.22 0.39
10:53:28Average c62t0d2 0.12 0.50 2 66 4.71 0.50

One pipe worked...


But I must say - Doug O'Leary's script in the link in the post that my good friend Hein posted above works great!

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
James R. Ferguson
Acclaimed Contributor

Re: Can you retrieve sar data for one disk device?

Hi Geoff:

One pipe. I just can't type today :-))

BTW, the problem with the daily files is that they are binary files, hence require some more special treatment. Ooops.

Regards!

...JRF...
Geoff Wild
Honored Contributor

Re: Can you retrieve sar data for one disk device?

Small bug in Doug O'Leary's script:

# /usr/local/bin/sar-d.pl -f /var/adm/sa/sa20 -d c62t0d2
Time Device % Que r+w Blks avgwio avgsvc
================================================================================
00:10:01 c62t0d2 1.79 0.50 13 526 4.98 1.71
00:20:01 c62t0d2 1.66 0.50 11 464 5.12 1.82
00:30:01 c62t0d2 1.39 0.50 10 412 5.04 1.74
00:40:00 c62t0d2 0.66 0.50 9 274 5.13 0.73
00:50:00 c62t0d2 1.44 0.50 10 432 5.02 1.82
01:00:00 c62t0d2 1.25 0.50 8 361 4.95 1.87
01:10:00 c62t0d2 1.65 0.50 8 373 5.04 2.78
01:20:00 c62t0d2 0.77 0.50 3 337 4.96 2.89
01:30:00 c62t0d2 0.56 0.50 1 126 5.11 4.18
01:40:00 c62t0d2 1.52 0.50 5 252 5.00 4.42
01:50:00 c62t0d2 0.90 0.50 5 162 5.07 1.94
02:00:00 c62t0d2 1.60 0.50 7 309 5.03 2.98
02:10:00 c62t0d2 0.51 0.50 4 149 5.00 1.32
02:30:00 c62t0d2 1.64 0.50 7 377 5.01 3.06
02:40:01 c62t0d2 1.00 0.50 5 270 5.07 2.48
02:50:00 c62t0d2 3.09 0.50 17 769 5.07 2.28
03:00:00 c62t0d2 2.39 0.50 15 634 5.01 1.82
03:10:00 c62t0d2 2.77 0.50 15 686 4.98 2.40
03:20:01 c62t0d2 1.63 0.50 8 468 4.97 2.28
03:30:00 c62t0d2 1.13 0.50 5 288 4.97 2.65
03:40:00 c62t0d2 0.40 0.50 5 150 5.03 0.78
03:50:01 c62t0d2 0.55 0.50 7 195 5.06 0.77
04:00:00 c62t0d2 0.80 0.50 6 256 4.98 1.75
04:10:00 c62t0d2 0.41 0.50 3 129 5.02 1.23
04:20:01 c62t0d2 0.14 0.50 2 45 4.96 0.87
04:30:00 c62t0d2 0.16 0.50 1 41 4.96 1.01
04:40:00 c62t0d2 0.76 0.50 3 192 4.94 3.15
04:50:00 c62t0d2 0.17 0.50 2 72 5.08 0.73
05:00:00 c62t0d2 0.17 0.50 3 77 5.12 0.73
05:10:00 c62t0d2 0.29 0.50 3 123 4.83 1.19
05:20:00 c62t0d2 0.39 0.50 5 152 5.06 0.76
05:30:00 c62t0d2 1.19 0.50 8 326 5.10 1.98
05:40:01 c62t0d2 0.20 0.50 3 85 4.80 0.69
05:50:00 c62t0d2 0.35 0.50 5 150 5.03 0.66
06:00:01 c62t0d2 0.86 0.50 4 216 5.02 2.74
06:10:00 c62t0d2 0.43 0.50 5 176 5.05 0.80
06:20:00 c62t0d2 2.00 0.50 8 650 4.91 3.04
06:30:00 c62t0d2 1.95 0.50 9 668 5.03 2.82
06:40:00 c62t0d2 1.42 0.50 6 470 5.03 2.63
06:50:01 c62t0d2 1.57 0.50 9 636 5.09 1.96
07:00:00 c62t0d2 0.35 0.50 4 151 4.96 0.93
07:10:01 c62t0d2 0.99 0.50 6 303 4.94 2.15
07:20:01 c62t0d2 0.22 0.50 3 94 4.83 0.75
07:30:01 c62t0d2 0.24 0.50 4 102 5.06 0.68
07:40:01 c62t0d2 0.85 0.50 4 209 5.08 2.50
07:50:00 c62t0d2 0.30 0.50 4 122 4.88 0.71
08:00:00 c62t0d2 0.32 0.50 6 153 5.03 0.62
08:10:00 c62t0d2 0.83 0.50 5 240 5.17 2.02
08:20:00 c62t0d2 0.43 0.50 5 163 5.08 0.88
08:30:02 c62t0d2 0.51 0.50 5 173 5.04 1.25
08:30:02 c28t6d0 3.60 188.67 28 2235 152.79 8.68
08:30:02 c3t6d0 5.23 159.66 34 2512 140.28 9.53
08:40:00 c62t0d2 0.93 0.50 5 244 5.13 2.15
08:40:00 c28t6d0 2.36 143.86 18 518 117.53 9.02
08:50:00 c62t0d2 1.15 0.50 7 378 5.08 1.90
09:00:00 c62t0d2 1.12 0.50 7 362 4.97 1.88
09:10:00 c62t0d2 1.46 0.50 9 470 5.10 1.87
09:20:00 c62t0d2 1.03 0.50 7 335 5.09 1.83
09:30:00 c62t0d2 0.57 0.50 7 228 5.02 0.79
09:40:01 c62t0d2 1.10 0.50 6 308 5.09 1.97
09:50:00 c62t0d2 1.12 0.50 7 322 5.00 2.11
10:00:00 c62t0d2 0.41 0.50 5 153 5.17 0.79
10:10:00 c62t0d2 0.30 0.50 4 125 5.05 0.81
10:20:00 c62t0d2 0.75 0.50 5 236 5.11 2.14
10:30:01 c62t0d2 0.20 0.50 3 89 5.13 0.67
10:40:00 c62t0d2 0.33 0.50 4 135 5.05 0.78
10:50:00 c62t0d2 0.82 0.50 6 271 4.99 1.72
11:00:01 c62t0d2 0.38 0.50 6 176 4.98 0.69
11:10:00 c62t0d2 0.93 0.50 7 343 5.03 1.49
11:20:00 c62t0d2 0.91 0.50 6 276 4.99 1.84
11:30:00 c62t0d2 0.33 0.50 4 125 5.00 0.79
11:40:00 c62t0d2 0.36 0.50 4 129 5.06 0.82
11:50:01 c62t0d2 0.99 0.50 6 286 5.04 1.89
12:00:00 c62t0d2 0.28 0.50 4 127 5.17 0.73
12:10:00 c62t0d2 0.64 0.50 5 251 4.97 1.71
12:20:00 c62t0d2 0.44 0.50 6 185 4.98 0.80
12:30:00 c62t0d2 0.34 0.50 4 128 5.14 0.78
12:40:00 c62t0d2 0.95 0.50 5 229 5.04 2.50
12:50:00 c62t0d2 0.36 0.50 5 143 5.08 0.68
13:00:01 c62t0d2 1.03 0.50 8 330 5.09 1.49
13:10:00 c62t0d2 0.70 0.50 7 242 5.07 1.05
13:20:00 c62t0d2 0.82 0.50 5 255 5.04 2.05
13:30:01 c62t0d2 0.41 0.50 5 145 5.05 0.76
13:40:00 c62t0d2 0.74 0.50 5 231 5.08 2.18
13:50:00 c62t0d2 0.30 0.50 4 132 5.12 0.60
14:00:00 c62t0d2 0.35 0.50 5 140 5.02 0.72
14:10:00 c62t0d2 0.81 0.50 6 273 5.06 1.91
14:20:01 c62t0d2 0.95 0.50 9 376 5.03 1.30
14:30:00 c62t0d2 0.41 0.50 6 172 5.04 0.79
14:40:00 c62t0d2 0.33 0.50 5 154 4.93 0.69
14:50:00 c62t0d2 0.71 0.50 6 260 5.12 1.50
15:00:00 c62t0d2 0.46 0.50 6 198 5.00 0.77
15:10:00 c62t0d2 1.06 0.50 7 347 4.97 1.85
15:20:01 c62t0d2 0.82 0.50 7 315 5.05 1.41
15:30:00 c62t0d2 0.51 0.50 4 142 5.06 1.12
15:40:00 c62t0d2 0.46 0.50 3 94 5.02 1.53
15:50:00 c62t0d2 1.70 0.50 4 222 4.98 5.39
16:00:01 c62t0d2 0.29 0.50 4 123 4.90 0.76
16:10:00 c62t0d2 0.23 0.50 3 89 4.94 0.81
16:20:00 c62t0d2 0.76 0.50 4 208 4.97 2.56
16:30:00 c62t0d2 0.15 0.50 2 66 5.09 0.65
16:40:00 c62t0d2 0.46 0.50 4 109 5.00 1.38
16:50:00 c62t0d2 0.34 0.50 3 81 4.96 1.34
17:00:01 c62t0d2 0.14 0.50 1 34 4.88 1.11
17:10:00 c62t0d2 1.87 0.50 7 534 4.94 3.37
17:20:01 c62t0d2 1.56 0.50 8 528 4.97 2.23
17:30:00 c62t0d2 2.01 0.50 9 630 5.12 2.92
17:40:00 c62t0d2 2.25 0.50 10 685 5.02 2.72
17:50:00 c62t0d2 2.18 0.50 9 680 4.99 2.79
18:00:00 c62t0d2 2.03 0.50 10 681 5.01 2.45
18:10:00 c62t0d2 4.49 0.50 11 1066 5.03 4.57
18:20:01 c62t0d2 4.80 0.50 15 1361 5.05 3.96
18:30:01 c62t0d2 4.94 0.50 16 1538 5.01 3.84
18:40:01 c62t0d2 4.48 0.50 17 1724 4.98 3.18
18:50:01 c62t0d2 4.90 0.50 17 1687 5.05 3.47
19:00:00 c62t0d2 2.89 0.50 13 995 5.06 2.71
19:10:00 c62t0d2 2.57 0.50 11 877 5.06 2.80
19:20:00 c62t0d2 0.11 0.50 1 41 4.90 1.04
19:30:00 c62t0d2 0.03 0.50 1 19 4.80 0.68
19:40:00 c62t0d2 0.05 0.50 1 18 4.68 0.55
19:50:00 c62t0d2 0.03 0.50 1 17 4.94 0.65
20:00:00 c62t0d2 0.05 0.50 1 16 5.10 0.65
20:10:00 c62t0d2 0.06 0.50 1 24 5.04 0.80
20:20:01 c62t0d2 0.07 0.50 1 27 5.19 0.77
20:30:00 c62t0d2 0.13 0.50 1 49 5.00 1.03
20:40:00 c62t0d2 0.80 0.50 2 216 5.09 4.71
20:50:00 c62t0d2 0.08 0.50 1 29 5.23 0.76
21:00:00 c62t0d2 0.08 0.50 1 30 4.78 0.77
21:10:00 c62t0d2 0.50 0.50 4 182 5.08 1.07
21:20:00 c62t0d2 0.90 0.50 5 273 5.04 2.25
21:30:00 c62t0d2 0.39 0.50 5 157 5.12 0.82
21:40:00 c62t0d2 0.75 0.50 4 230 5.02 2.50
21:50:01 c62t0d2 0.18 0.50 2 78 5.06 0.80
22:00:00 c62t0d2 0.17 0.50 2 59 5.14 0.87
22:10:00 c62t0d2 0.19 0.50 2 86 4.89 0.92
22:20:00 c62t0d2 0.65 0.50 3 190 5.06 2.89
22:30:00 c62t0d2 0.17 0.50 2 77 5.01 1.00
22:40:00 c62t0d2 0.10 0.50 1 39 4.94 1.10
22:50:00 c62t0d2 0.09 0.50 1 42 4.96 0.78
23:00:01 c62t0d2 0.22 0.50 2 89 5.05 1.09
23:10:01 c62t0d2 0.99 0.50 5 307 5.07 2.31
23:20:01 c62t0d2 1.06 0.50 8 353 5.04 1.55
23:30:00 c62t0d2 0.93 0.50 6 316 4.97 1.81
23:40:00 c62t0d2 0.24 0.50 3 105 4.99 0.75
23:50:00 c62t0d2 0.16 0.50 2 74 4.94 0.71


Some reason it displayed c28t6d0 twice and c3t6d0 once....not too sure why....

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Doug O'Leary
Honored Contributor
Solution

Re: Can you retrieve sar data for one disk device?

Hey, Geoff;

You got the correct email address; thanks for the note and I'm glad the script works - most of the way - for you.

The reason those other two disks show up is their average time spent waiting for I/O is over 100ms. Effectively, all the arguments are ||'ed together. The script defaults the avgwio to 100ms so effectively, your command line says "Show me any disk that's named c62t0d2 or has an avgio >= 100"

When I originally wrote the script, I was having issues w/large avgwios and, instead of contantly typing -w 100, I just put it in as a default. There's two ways to work around the issue:

1. Put in a larger -w option:
# /usr/local/bin/sar-d.pl -f /var/adm/sa/sa20 -d c62t0d2 -w 200

2. Comment out where I put in the default. Change line 82 from:

$args{w} = 100 unless defined($args{w});

to

# $args{w} = 100 unless defined($args{w});

Either option should work for you.

I'm glad you like the script other than that. Let me know if there's anything else you find in there.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Geoff Wild
Honored Contributor

Re: Can you retrieve sar data for one disk device?

Doug's script worked perfectly.

A must have for any admin.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.