VMware {code} Community
sajuptpm
Contributor
Contributor

Difference between QueryPerf and QueryPerfComposite


* QueryPerfComposite doesn't not returning all instances of the metric for the    specified counterId. why ??
check instance property http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.PerformanceManager.Me...

1) QueryPerfComposite without perfMetric_cpu.instance = "*"
================================================


def get_metrics_QueryPerfComposite(client, mob):
     statInterval = client.sc.perfManager.QueryPerfProviderSummary(entity=mob)
    
     perfMetric_cpu = client.create("PerfMetricId")
     perfMetric_cpu.counterId = get_perf_counter(client)
     #perfMetric_cpu.instance = "*"

     perfSpec = client.create("PerfQuerySpec")
     perfSpec.entity = mob._mo_ref
     perfSpec.intervalId = statInterval.refreshRate
     perfSpec.metricId = [perfMetric_cpu]
     perfSpec.maxSample = 1
    
     result = client.sc.perfManager.QueryPerfComposite(querySpec=perfSpec)
     print "=======result=======", result


######### OUTPUT ########

====counterid==== 2
=======result======= (PerfCompositeMetric){
    entity =
       (PerfEntityMetric){
          entity = <psphere.managedobjects.HostSystem object at 0xbce42d0>
          sampleInfo[] =
             (PerfSampleInfo){
                timestamp = 2012-09-11 20:38:00
                interval = 20
             },
          value[] =
             (PerfMetricIntSeries){
                id =
                   (PerfMetricId){
                      counterId = 2
                     instance = None
                   }
                value[] =
                   225,
             },
       }
    childEntity[] =
       (PerfEntityMetric){
          entity = <psphere.managedobjects.VirtualMachine object at 0xbce40d0>
          sampleInfo[] =
             (PerfSampleInfo){
                timestamp = 2012-09-11 20:38:00
                interval = 20
             },
          value[] =
             (PerfMetricIntSeries){
                id =
                   (PerfMetricId){
                      counterId = 2
                      instance = None
                   }
                value[] =
                   202,
             },
       },
  }


2) QueryPerf with perfMetric_cpu.instance = "*"
=====================================


def get_metrics_QueryPerf(client, mob):
     statInterval = client.sc.perfManager.QueryPerfProviderSummary(entity=mob)
    
     perfMetric_cpu = client.create("PerfMetricId")
     perfMetric_cpu.counterId = get_perf_counter(client)
     perfMetric_cpu.instance = "*"

     perfSpec = client.create("PerfQuerySpec")
     perfSpec.entity = mob._mo_ref
     perfSpec.intervalId = statInterval.refreshRate
     perfSpec.metricId = [perfMetric_cpu]
     perfSpec.maxSample = 1
    
     result = client.sc.perfManager.QueryPerf(querySpec=perfSpec)
     print "=======result=======", result


######### OUTPUT ########

====counterid==== 2
=======result======= [(PerfEntityMetric){
    entity = <psphere.managedobjects.HostSystem object at 0xbac1490>
    sampleInfo[] =
       (PerfSampleInfo){
          timestamp = 2012-09-11 20:44:00
          interval = 20
       },
    value[] =
       (PerfMetricIntSeries){
          id =
             (PerfMetricId){
                counterId = 2
                instance = "0"
             }
          value[] =
             389,
       },
       (PerfMetricIntSeries){
          id =
             (PerfMetricId){
                counterId = 2
               instance = "1"
             }
          value[] =
             427,
       },
       (PerfMetricIntSeries){
          id =
             (PerfMetricId){
                counterId = 2
               instance = None
             }
          value[] =
             408,
       },
  }]



3) QueryPerf without perfMetric_cpu.instance = "*"
=======================================


def get_metrics_QueryPerf(client, mob):
     statInterval = client.sc.perfManager.QueryPerfProviderSummary(entity=mob)
    
     perfMetric_cpu = client.create("PerfMetricId")
     perfMetric_cpu.counterId = get_perf_counter(client)
    #perfMetric_cpu.instance = "*"

     perfSpec = client.create("PerfQuerySpec")
     perfSpec.entity = mob._mo_ref
     perfSpec.intervalId = statInterval.refreshRate
     perfSpec.metricId = [perfMetric_cpu]
     perfSpec.maxSample = 1
    
     result = client.sc.perfManager.QueryPerf(querySpec=perfSpec)
     print "=======result=======", result

######### OUTPUT ########

====counterid==== 2
=======result======= [(PerfEntityMetric){
    entity = <psphere.managedobjects.HostSystem object at 0xba20490>
    sampleInfo[] =
       (PerfSampleInfo){
          timestamp = 2012-09-11 20:43:20
          interval = 20
       },
    value[] =
       (PerfMetricIntSeries){
          id =
             (PerfMetricId){
                counterId = 2
                instance = None
             }
          value[] =
             341,
       },
  }]


Reply
0 Kudos
0 Replies