How to calculate the average of cpu usage and memory usage over a period of time in ubuntu
Solution 1:
You can use
cat /proc/loadavg
That gives you the 3 load average numbers for the period 1, 5, and 15 minutes.
Then the number of currently running processes and then the pid of the last called process.
I don't know what you mean with the median and deviation values.
But hopefully this is a start for you.
cat /proc/meminfo
gives you memory stats.
The /proc directory could give you more infos for your needs. Just cat /proc/xxxx the file you are interested in.
cat
is just a programm to show the contents of a file to your termial. Jo can use your javaprogramm or whatever to read those files and send the values to your database.