Page 1 of 1

check_vsphere_xi.py incorrect cpu usage

Posted: Tue Jun 18, 2024 4:38 am
by evt
Hi,
I've just finished to install a new Nagios server release 2024R1.1.4 on RHEL 8.10
I'm trying to monitor a virtual machine host on vCenter 8 server using the new wizard vSphere in python mode (so without VMware SDK)
The generating command is:
python3 /usr/local/nagios/libexec/check_vsphere_xi.py -H "my_vCenter" -f "/usr/local/nagiosxi/etc/components/vsphere/my_vCenter.txt" -N "my_VM" -l "CPU" "" "" "" "" ""
And the result is:
OK: my_VM cpu usage=83.0 MB (380.00%), wait=19346.00 ms, ready=87.00 ms | cpu_usagemhz=83.00;; cpu_usage=380.00%;; cpu_wait=19346.00ms;; cpu_ready=87.00ms;;
So you can see that the cpu usage is not correct. The return value is in MB and the percent is also incorrect. Other values are correct.
Thanks for your help,
EVT

Re: check_vsphere_xi.py incorrect cpu usage

Posted: Wed Jun 19, 2024 10:20 am
by bbahn
Hello @evt,

The units are definitely wrong and I'll make a patch for that, but are you sure the numbers are wrong? vSphere uses vCPUs, which mean that a VM could have greater than 100% CPU usage if it has multiple vCPUs. If any of the metrics are correct, then that means your vSphere server is returning those values and it isn't a miscalculation.

Re: check_vsphere_xi.py incorrect cpu usage

Posted: Thu Jun 20, 2024 3:30 am
by evt
Hi bbahn,
Thanks for your answer. I confirm that return value is wrong, the correct value was around 4%. Note that the test has been done on a VM with only one vCPU to avoid multi-core calculation.