ramesh9 Acclaimed Contributor.
Acclaimed Contributor.
679 views

script to extract metric value from SCOPE/CODA

Jump to solution

Hi All

Is anyone has either shell or perl script which I can include on scheduled/measurement threshold policy to extract particular metric data from SCOPE/CODA

Please to share if you have the script.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: script to extract metric value from SCOPE/CODA

Jump to solution

Hello Ramesh,

Check Sys_CPUBottleneckDiagnosis or SI-CPUBottleneckDiagnosis. You will see code like below in the critical threshold script that is implement to load OS specific metrics:

if ($source eq "SCOPE") {
 if ($^O eq qw/hpux/) {
  # Getting the CPU queue length
  $ProcQueueLensrc=$Policy->SourceEx("CODA\\\\SCOPE\\\\GLOBAL\\\\GBL_CPU_QUEUE");
  if ($ProcQueueLenSrc && $ProcQueueLenSrc->DataAvailable())
  {
   $Session->Value("ProcQueueLen", floor($ProcQueueLenSrc->Value()));
  }
  else
  {
   $tracer->SendLogMessage ( "SourceEx API failed for metric: CODA\\\\SCOPE\\\\GLOBAL\\\\GBL_CPU_QUEUE", "warning");
  }

Upon looking in detail, you will see that the code handles the situation differently depending on whether scope is detected or not. Since OA 11.x, you may consider that scope is available and hence don't need to implement such a check in your own policies.

The above example applies for metrics from the GLOBAL class. If you are looking for other classes, then chances are that you need different code to account for multiple instances. For this, you can check Sys_DIskCapacityMonitor or SI-DiskCapacityMonitor. This code is significantly more complicated as the metric values are loaded into a hash table that requires additional memory management. It uses functions defined in SpiMetricHash.

Regards,
Thierry.

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
5 Replies
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: script to extract metric value from SCOPE/CODA

Jump to solution

Hello Ramesh,

Within a schedule task policy you can always call the below function for OA 12.0x node. For OA 11.1X, you have to export CODAMAGIC before running this command. 

'ovcodautil -ds <Data_Source> -o <Class> -m <Metric_Name> -flat -last'

Multiple metric names can be given, separated with comma.

For example:

# set CODAMAGIC
$CODAMAGIC = `set CODAMAGIC=0x05201993`;
my $fs_space_util = `ovcodautil -ds SCOPE -o FS -m "FS_DIRNAME,FS_SPACE_UTIL" -flat -last`;


[root@VM ~]# ovcodautil -ds SCOPE -o FS -m "FS_DIRNAME,FS_SPACE_UTIL" -flat -last
=== 02/28/18 09:50:00 PM
Instance : 0
FS_DIRNAME : /
FS_SPACE_UTIL : 8.08


=== 02/28/18 09:50:00 PM
Instance : 1
FS_DIRNAME : /dev
FS_SPACE_UTIL : 0.00


=== 02/28/18 09:50:00 PM
Instance : 2
FS_DIRNAME : /
FS_SPACE_UTIL : 8.08


=== 02/28/18 09:50:00 PM
Instance : 3
FS_DIRNAME : /boot
FS_SPACE_UTIL : 16.02

I would rather suggest you to use Measurement threshold policy with configuring the Data source and metrics. Out of the box Infra MP policies should help you in acheiving the same.

Regards,

Kallol Roy

ramesh9 Acclaimed Contributor.
Acclaimed Contributor.

Re: script to extract metric value from SCOPE/CODA

Jump to solution

Dear

Do you have any OOB System Infra MP policy which shows how to collect values from CODA/SCOPE metrics and then do calculation and again store the end-result to other metric.

If yes please can you suggest.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: script to extract metric value from SCOPE/CODA

Jump to solution

Hello Ramesh,

Check Sys_CPUBottleneckDiagnosis or SI-CPUBottleneckDiagnosis. You will see code like below in the critical threshold script that is implement to load OS specific metrics:

if ($source eq "SCOPE") {
 if ($^O eq qw/hpux/) {
  # Getting the CPU queue length
  $ProcQueueLensrc=$Policy->SourceEx("CODA\\\\SCOPE\\\\GLOBAL\\\\GBL_CPU_QUEUE");
  if ($ProcQueueLenSrc && $ProcQueueLenSrc->DataAvailable())
  {
   $Session->Value("ProcQueueLen", floor($ProcQueueLenSrc->Value()));
  }
  else
  {
   $tracer->SendLogMessage ( "SourceEx API failed for metric: CODA\\\\SCOPE\\\\GLOBAL\\\\GBL_CPU_QUEUE", "warning");
  }

Upon looking in detail, you will see that the code handles the situation differently depending on whether scope is detected or not. Since OA 11.x, you may consider that scope is available and hence don't need to implement such a check in your own policies.

The above example applies for metrics from the GLOBAL class. If you are looking for other classes, then chances are that you need different code to account for multiple instances. For this, you can check Sys_DIskCapacityMonitor or SI-DiskCapacityMonitor. This code is significantly more complicated as the metric values are loaded into a hash table that requires additional memory management. It uses functions defined in SpiMetricHash.

Regards,
Thierry.

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
ramesh9 Acclaimed Contributor.
Acclaimed Contributor.

Re: script to extract metric value from SCOPE/CODA

Jump to solution

Thanks Thierry.

I see $Policy->SourceEx() is used to collect value from stored metric. Do you have any idea of which function can be used to store value in CODA/SCOPE metric.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: script to extract metric value from SCOPE/CODA

Jump to solution

Hello Ramesh,

Have a look at the policy Clus_ClusterDataCollector.

Regards,
Thierry.

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.