pgkda.blogg.se

Bash script to monitor cpu and memory usage
Bash script to monitor cpu and memory usage





bash script to monitor cpu and memory usage

As you see CPU0 is most used while CPU 1-3 are mostly idle. For example to check CPU usage per core for 2 interval with 1 second gap use below command. Similarly you can use -P to check CPU usage per core. For example to check CPU usage for two intervals with a gap of 1 second # sar -u 1 2 To check CPU usage using sar you can use -u. I have written another article with all the system resources you can monitor using sar. Sar is another powerful monitoring tool which is used by most professionals (my personal favourite). Tasks: 120 total, 3 running, 117 sleeping, 0 stopped, 0 zombie To check top CPU consuming process execute top and then press "shift + p" which will sort and list the high CPU usage process in Linux. Top is a very useful tool for system administrators to monitor system resources.

bash script to monitor cpu and memory usage

If you just wish to monitor top CPU consuming process then there are various utilities such as top, vmstat, sar which can help you check high cpu usage process and give you runtime CPU utilization status in detail.

bash script to monitor cpu and memory usage

Now what if you wish to check top cpu and memory utilization process, so in this article we will go one step ahead and write a shell script to check top CPU consuming process and top Memory consuming process in Linux Earlier I had written an article with the commands to check memory usage per process in Linux.







Bash script to monitor cpu and memory usage