check_vsphere_xi.py incorrect cpu usage

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
evt
Posts: 4
Joined: Tue Jun 18, 2024 4:05 am

check_vsphere_xi.py incorrect cpu usage

Post 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
bbahn
Posts: 320
Joined: Thu Jan 12, 2023 5:42 pm

Re: check_vsphere_xi.py incorrect cpu usage

Post 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.
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
evt
Posts: 4
Joined: Tue Jun 18, 2024 4:05 am

Re: check_vsphere_xi.py incorrect cpu usage

Post 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.
Post Reply