|
Hello.
Need some
assistance.
At the moment I am trying to make some of my custom reports behave a
bit better.
Basically it is a report that reports on IO activity on a per disk
basis.
Every 5 min iostat is run and the data is then inserted into a table
called stats$iostat, structure as follows
CREATE TABLE perfstat.stats$iostat
(
snap_time date,
elapsed_seconds number(4),
hdisk varchar2(8),
kb_read number(9,0),
kb_write number(9,0)
);
In this table it get x amount of records every 5 min, a record for
every drive that is installed on a the machine.
Currently I am running the following query in statspack.
select hdisk,
to_char(snap_time,'yyyy-mm-dd HH24') "Date Hour",
sum(kb_read) sum_kb_read,
sum(kb_write) sum_kb_write
from
stats$iostat
group by
hdisk,
to_char(snap_time,'yyyy-mm-dd HH24')
This returns for every hour of the day a value for the every drive.No
the problem is this does not work nicely with statspack viewer.
Looking at your reports if I was to draw summalarities between them
you would return averages per drive, then when I double click on the
value you return the per hour or snap shot value for that specific
paramater.
I need to change the above to something likewise. Say initial report
displays the averages for every drive and then when I double click the
drive it draws the drive on a per hour basis.
Any help would be appreciated, once I got the one report sorted out I
can apply the same logic to the other data sets, vmstat, sar -w, sar
-u, sar -r
I am attaching a txt document compressed to show how the data
currently looks inside the database for the iostat table.
thx
Answer:
I modified
a little bit your table by adding a new column snap_id in order to
link stats data to STATSPACK's snapshots.
This facilitates the report writing and allows you to use standard
technique to write STATSPACK based reports for your own tables.
The create table statement looks like:
CREATE TABLE perfstat.stats$iostat
(
snap_id number,
snap_time date,
elapsed_seconds number(4),
hdisk varchar2(8),
kb_read number(9,0),
kb_write number(9,0)
);
I have added the following sample data to this table to build example
reports:
insert into stats$iostat values ( 1 , sysdate-5/24 , 0 , 'md10', 84 ,
123 );
insert into stats$iostat values ( 1 , sysdate-5/24 , 0 , 'md101', 74 ,
120 );
insert into stats$iostat values ( 1 , sysdate-5/24 , 0 , 'md70', 64 ,
100 );
insert into stats$iostat values ( 2 , sysdate-4/24 , 0 , 'md10', 23 ,
45 );
insert into stats$iostat values ( 2 , sysdate-4/24 , 0 , 'md101', 64 ,
66 );
insert into stats$iostat values ( 2 , sysdate-4/24 , 0 , 'md70', 12 ,
132 );
insert into stats$iostat values ( 3 , sysdate-3/24 , 0 , 'md10', 23 ,
45 );
insert into stats$iostat values ( 3 , sysdate-3/24 , 0 , 'md101', 64 ,
66 );
insert into stats$iostat values ( 3 , sysdate-3/24 , 0 , 'md70', 12 ,
132 );
insert into stats$iostat values ( 4 , sysdate-2/24 , 0 , 'md10', 29 ,
25 );
insert into stats$iostat values ( 4 , sysdate-2/24 , 0 , 'md101', 24 ,
86 );
insert into stats$iostat values ( 4 , sysdate-2/24 , 0 , 'md70', 121 ,
32 );
insert into stats$iostat values ( 5 , sysdate-1/24 , 0 , 'md10', 73 ,
55 );
insert into stats$iostat values ( 5 , sysdate-1/24 , 0 , 'md101', 14 ,
66 );
insert into stats$iostat values ( 5 , sysdate-1/24 , 0 , 'md70', 12 ,
92 );
commit;
Note that you should rewrite your procedure that gathers the data to
this table in order to correctly populate snap_id column.
Now, we create and save a new report called say "Disk I/O Statistics"
with the following sql text:
select
hdisk,
Avg(kb_read) "Reads",
Avg(kb_write) "Writes"
from
stats$iostat
Where
snap_id > :pBgnSnap and
snap_id <= :pEndSnap and
:pDbId = :pDbId and
:pInstNum = :pInstNum
Group by hdisk
As you can see, this report allows you to get averages for i/o stats
for the whole chosen snapshot interval.
If you click on a particular statistic likewise you did in the
standard reports, you will get the detailed report for this statistic.
Note that I use dummy parameter equals like :pDbId = :pDbId and
:pInstNum = :pInstNum. This is done in order Statspack Viewer Pro
recognizes this report as STATSPACK based report. |