pcp
[Top] [All Lists]

Oracle PMDA - sysstat values

To: "pcp@xxxxxxxxxxx" <pcp@xxxxxxxxxxx>
Subject: Oracle PMDA - sysstat values
From: "Narendra Babu, Nandhita" <nandhita.narendra.babu@xxxxxxxxx>
Date: Fri, 15 Jan 2016 20:27:10 +0000
Accept-language: en-US
Cc: "Nelson, Doug" <doug.nelson@xxxxxxxxx>, "Narendra Babu, Nandhita" <nandhita.narendra.babu@xxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <5192D9F1A7351C4C8C307FF33726DDD5020507ED@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <5192D9F1A7351C4C8C307FF33726DDD5020507ED@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Thread-index: AdFPzSZIvqZKQBVVSO+8+Juk+2oxywAAEilA
Thread-topic: Oracle PMDA - sysstat values

Hi All,

 

I have been working on Oracle PMDA for a while now. I was able to make some changes to the source code and get the values printed out by Pmval (after referring to Postgresql PMDA) for all instances except sysstat.

 

select statistic#, value from v$sysstat;

This SQL returns1178 rows of statistics, out of which 179 are listed as performance metrics in setup_sysstat.

 

I thought one way to extract a specific statictic# and it’s value is by using the $item number in sysstat_values sub.

For example:

my @sysstat_stats = "(2,3,4,5,6,7,……..,1076,1162,1163)"; #which has statistic# for all 179 performance metric items

sub sysstat_values  {

    if (defined($result)) {

        for my $i (0 .. $#{$result}) {

            my $statistic_num = $result->[$i][0];

            if ($statistic_num==$sysstat_stats[$item]){

                my $instname = "$sid/statistics# $statistic_num";

                my $values = $result->[$i];

                $sid_instances{$instname} = $values;

            }}}

$pmda->replace_indom($sid_indom, \%sid_instances);

}

Now, I can pass the values of the desired statistic# to oracle_fetch_callback with $value = $columns[1]. The trouble is, I am unable to get the $item number in this sub. Only oracle_fetch_callback knows the $item number and I have no clue how the values are passed to these sub. Is there a way to do this?

 

The other method I thought was, to alter sql statement to convert the rows to columns and as usual oracle_fetch_callback will return the $value as $columns[$item] :

my $sysstat_statistics = "(2,3,4,……,1163)”;

fetch => "select * from (select STATISTIC#, value from v\$sysstat) pivot (max(value) for STATISTIC# in $sysstat_statistics)"

The output of sql looks like:

         2          3          4         1163

---------- ---------- ---------- ……... ----------

    161128         30    3971430        349862

Here the problem  is I am unable to get the $instname, because  statistic# is now the column header.

 

I think in all cases, I would need the $item number. If not, there must be a different logic altogether. I have attached two files for method 1 and 2. If you know a better way to get sysstat values, please let us know.

 

Thanks,

Nandhita

 

 

 

 

Attachment: pmdaoracle.zip
Description: pmdaoracle.zip

<Prev in Thread] Current Thread [Next in Thread>