I recently set up a really cheap VPS mainly for backup purposes but I also wanted it to do some small, minor tasks. But because I was too interested I wanted to take a look at CPU and Memory usage, since I only got (probably part of) 1 Core of unknown CPU and 128 MB of RAM, running Ubuntu 16.04 LTS. I created a cronjob calling a PHP Script which checks CPU and Memory usage and if at least one of both is high, it will write the info to a file. I use the PHP systeminfo commands to check CPU and MEM load and then use this to get more info about the processes using up the most CPU.
But for some reason it outputs this:
27.05. 20:05:12 CPU:109% - RAM:72.11%
ps: 1.0 6556 php
ps: 0.5 6518 /usr/sbin/mysqld
ps: 0.0 1 init
28.05. 00:02:43 CPU:288% - RAM:39.45%
ps: 0.1 19968 /usr/sbin/mysqld
ps: 0.0 1 init
ps: 0.0 2 [kthreadd/6457]
28.05. 00:05:01 CPU:158% - RAM:49.24%
ps: 0.1 20046 /usr/bin/python3
ps: 0.0 1 init
ps: 0.0 2 [kthreadd/6457]
So I got the date and time, the CPU and MEM usage by PHP and below the info from ps command: CPU load, PID and command. Would I have to multiply the CPU load numbers by 100 to get % or why are these numbers so low, when obviously the CPU is at 288% load sometimes. Or is this normal behavior for a VPS and PHP is measuring the real CPU load of the whole system while ps is only showing the load of my part of the CPU or the other way around?
Can someone explain please?