4

I need to collect data about disk utilization for selected disks. I can use glance-plus monitoring tool to display the current data in percents (it looks similar to top), but I need to collect these values into a file so that I can create graphs from it.

Unfortunately this isn't possible in glance so I wanted to create some own script for this purpose. I managed to create a script which collects number of blocks read / write per second, but I don't know how could I easily convert this to percents because I don't really know what the maximal utilization could be. The script is bellow:

#!/bin/sh
list=`iostat 10 2 | grep -v ' 0' | grep -v 'device' | grep -vE '^ *$' | sed 's/^........ *//' | sed 's/ .*//'`
value=0
for rt in `echo $list`
do
value=`expr $rt + $value`
done

echo `expr $value / 10`

is there any easier way to do this on hp-ux preferably using some free / default tools

1 Answer 1

4

Note that glance can be scripted:

# cat /opt/perf/examples/adviser/disk_sar

  #The following glance adviser disk loop shows disk activity comparable
  #to sar -d data.

  #Note that values will differ between sar and glance because of differing
  #data sources, calculation methods, and collection intervals.

headersprinted = 0

# For each disk, if there was activity, print a summary:
disk loop {
  if BYDSK_PHYS_IO_RATE > 0 then {
    # print headers if this is the first active disk found this interval:
    if headersprinted == 0 then {
      print "--------    device          %util   queue   r+w/s    KB/s    msecs-avserv"
      headersprinted = 1
    }
    print GBL_STATTIME, "   ",BYDSK_DEVNAME|15, BYDSK_UTIL|7|2,
          BYDSK_REQUEST_QUEUE|8|2, BYDSK_PHYS_IO_RATE|8|0,
          BYDSK_PHYS_BYTE_RATE|8|0, BYDSK_AVG_SERVICE_TIME|16|2
  }
}

if headersprinted == 0 then
  print GBL_STATTIME, "   (no disk activity this interval)"

To use that script :

glance -aos /opt/perf/examples/adviser/disk_sar  -j 5

Here BYDSK_UTIL is the % of time the disk is busy during the collection interval.

Read /opt/perf/paperdocs/gp/C/gp-metrics.txt and /opt/perf/paperdocs/ovpa/C/methp.txt to see the available metrics.

If you prefere other tools. You can use sar (by default on hp-ux) use egrep -f fiters to filter on your disk

for instance :
(the awk is to have a time stamp for each disks)

sar -d 5 10 | awk '/^[0-9]/ {t=$1} {sub("^........",t,$0); print }' | egrep -f myfilter
11:56:15   device   %busy   avque   r+w/s  blks/s  avwait  avserv
11:57:17 disk1680   23.76    0.50     200    3200    0.00    1.19
11:57:17 disk1689    0.99    0.50       1     507    0.00    5.45
11:57:17 disk1694   41.58    0.50     237    3786    0.00    1.75
11:57:17 disk1696    0.00    0.50       1      16    0.00    2.07
11:57:17 disk1707    0.99    0.50       1      16    0.00    5.82
11:57:17 disk1709    4.95    0.50       2    2044    0.00   24.10
11:57:17 disk1712    3.96    0.50       2    1980    0.00   23.69
...

With myfilter containing the disks you want to watch.

# cat  myfilter
disk1680 
disk1689 
...

add a blank character " " after each disks names, otherwise disk1 would match disk10

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .