VMware {code} Community
nerdstrom
Contributor
Contributor

Performance manager query (QueryPerf) not returning performance counter values

We have a single vcenter out of a larger set that is not returning any performance counter values for any of its virtual machines.  There are VMs on the vcenter that do have the proper tools installed that should allow us to get this information.  We do not receive any errors when trying to make the query, but nothing is returned - when logging into the vcenter web client, we can see up-to-date performance data for these VMs.

    def get_test_data():

        global perf_counter_id_to_obj, perf_metrics_id_objects

        counter_ids = [2, 3, 4, 24, 25, 26, 125, 126, 127, 143, 144, 145]

        perf_metrics_id_objects = [factory.PerfMetricId(counterId=id,

                                                        instance="*")

                                   for id in counter_ids]

        start_time = datetime.now() - timedelta(minutes=5)

        end_time = datetime.now()

        logger.info("Finding vm by uuid")

        vm_found_with_uuid = client.service.FindByUuid(service_content.searchIndex,

                                                       datacenter=None,

                                                       uuid=<uuid>,

                                                       vmSearch=True,

                                                       instanceUuid=True)

        logger.info(f"VM found with uuid: {vm_found_with_uuid}")

        logger.info(f"Getting query spec for {vm_found_with_uuid}")

        perf_query_list = factory.PerfQuerySpec(maxSample=1,

                                                entity=vm_found_with_uuid,

                                                intervalId=300,

                                                startTime=start_time,

                                                endTime=end_time,

                                                format='csv',

                                                metricId=perf_metrics_id_objects)

        logger.info(f"Query spec for {vm_found_with_uuid}: {perf_query_list}")

        perf_query_props = client.service.QueryPerf(service_content.perfManager, [perf_query_list])

        logger.info(f"Perf query props (results) are: {perf_query_props}")

References to "factory" and "client" are how we interact with a SOAP API (given a wsdl file) using the python package `zeep`.

This code returns values in the variable perf_query_props for all of our other vcenters.  We have found that when only passing the "entity" parameter into QueryPerf, we receive daily performance data for each day over the past year (ending two days before the current date).  Furthermore, when we pass "entity" and "intervalId=20", we get up-to-date raw streaming data.  Why can't we get 5 minute intervals?

Reply
0 Kudos
2 Replies
Denis_Chorbadzh
VMware Employee
VMware Employee

Hi,

 

I think you will be able to receive the right information for this issue on the vSphere Management SDK forum or the general vSphere forum.

Here is a link to the vSphere Management SDK Forum: https://code.vmware.com/forums/2416/vsphere-management-sdk

 

Best Regards,

Denis

Reply
0 Kudos
nerdstrom
Contributor
Contributor

Thank you, I will check out the link.

Reply
0 Kudos