Page 1 of 1
CPU and Memory Utilization
Posted: Mon May 24, 2021 7:34 am
by sneha.irali
Hi Team,
I would like to know the CPU and Memory Utilization for SUSE NCPA Agent(Basically the formula used for CPU Utilization for SUSE servers).
Suse version : 15.1
Nagios XI : 5.8.3
Regards,
Sneha Irali
Re: CPU and Memory Utilization
Posted: Mon May 24, 2021 9:59 am
by dchurch
The CPU percentage calculation is calculated by the Python library
psutil. NCPA asks it to sample the CPU usage for half (0.5) a second and average it.
See here for the relevant NCPA source code:
https://github.com/NagiosEnterprises/nc ... #L135-L141
How
psutils works internally is that it sums the number of "busy" cycles over that 0.5 seconds and divides it by the CPU's capacity. There's more to it, but that's the basics.
You can ask psutil to give you back these values by running this script:
Code: Select all
#!/usr/bin/env python3
import psutil as ps
print(ps.cpu_percent(interval=0.5, percpu=True))
If you're getting back more than 100% CPU utilization, it's because it's probably sampling more than one logical CPU. In which case it sums the percentages. I.e. if you have 2 CPU's at 75% utilization, it may say CPU utilization is at 150%.
Re: CPU and Memory Utilization
Posted: Tue May 25, 2021 6:32 am
by sneha.irali
Thanks.. I will check on the cpu utilization. Can you also please help me with the Memory utilization. I have the memory utilization and the swap memory been enabled for monitoring.
Re: CPU and Memory Utilization
Posted: Tue May 25, 2021 2:04 pm
by dchurch
I'm not sure what you mean by "help you out with the memory utilization" -- are you looking to decrease the amount of RAM that Nagios XI uses?