How to get the CPU load from the server

Posted on

Question :

I’m looking for ways to get the server CPU load, previously used scripts where there was the exec() function that on this other server has the function disabled by security.

Would there be another way to do this?


Answer :

You can use the PHPSysInfo library that is open source and not uses exec() , some of the information that can be obtained are: Activity time, RAM usage statistics, temperature, number of processes, kernel version, etc.


Another alternative is Linfo , cross-platform and you can get information such as: Statistics of RAM usage, disk space, activity time, kernel version, temperature, etc.



You can also use the sys_getloadavg() function.

This function returns an array containing 3 values representing a mean of the system load in the last 1, 5, and 15 minutes respectively.



Leave a Reply

Your email address will not be published. Required fields are marked *