CPU-Ready States

Hello everyone,

I am relatively new to Checkmk and would like to monitor the CPU Ready States. I find different posts on the internet about this. Mainly, it is written that it is either not possible yet or was possible at some point.

In one post, I read that evaluation via API is possible, but I haven’t made any progress, probably because I have no experience with APIs. Can someone tell me or give me an approach on how to read the values via API?

In an article, I came across the following: esx_vsphere_counters.

Can someone give me a tip on how to integrate this best?

Thank you in advance!

Hi Edwin,

checkmk itself is not able to show the ready state of vms. There is an entry in the ideas portal that you can vote for.

https://ideas.checkmk.com/suggestions/577742/cpu-ready-of-vmware

To get that, you can either

  1. extent the existing special agent for vsphere
  2. Fetch the data with pyvmomi

The vCenter Rest API does not provide the data, unfortunately.
With pyvmomi you can write your own special agent that fetches the data and assign that to the hosts/vms via piggyback data.

pyvmomi examples:

The relevant data is here (example):

for vm in vms:
        if vm.runtime.powerState == vim.VirtualMachinePowerState.poweredOn:
            metric_id = vim.PerformanceManager.MetricId(counterId=counter_id, instance="")
            query = vim.PerformanceManager.QuerySpec(entity=vm, metricId=[metric_id], intervalId=20, maxSample=1)
            stats = perf_manager.QueryPerf(querySpec=[query])

            if stats:
                cpu_ready_summation = stats[0].value[0].value[0]
                num_vcpus = vm.config.hardware.numCPU
                print(f"<<<<{vm.name}>>>>")
                print(f"<<<vm_cpu_ready:sep(58)>>>")
                print(f"{num_vcpus}:{cpu_ready_summation}")