![]() usage-plot.gp top.dat top. While true do top -p $PID -bMn 1 | egrep '^+' | awk -v now=$(date +%s) '' > top.dat done unix time - memory with m/g suffix - CPU load in % Run this script (perhaps via nohup) to capture the data: #!/bin/sh # If you have any suggestion or question please email to aravikumar48(yet)ĬPU_LOAD=`sar -P ALL 1 2 |grep 'Average.If you want to monitor the memory and CPU usage of a particular Linux process for a few minutes, perhaps during a performance test, you can capture the data with top and plot them with gnuplot. Keep reading to learn how. # It will send an email to $ADMIN, if the (cpu load is in %) percentage You’ll have to get it from your distro’s package manager. # Shell script to monitor or watch the high cpu-load Monitor Your CPU Utilization using Shell Script #!/bin/bash Below is the shell script which will alert you when CPU hits 70% utilization, you can also change this as per your requirement by changing the value of “LOAD=”. Before CPU hits HIGH utilization we have to reduce, take an preventing action. There is a situation where we want to keep an eye on our server CPU utilization because if your server CPU utilization goes HIGH you can’t process any other jobs since it is busy. ![]() This script required sar command installed in your Linux machine are else you may get error. Memory Usage: 33/512MB (6) Disk usage: 4.2/20GB (23) CPU Load: 0. Finally, awk sorts the result with a numeric reverse sort according to the total CPU and Memory usage and uses head to limit the report to the top 10 usage entries. This array uses the process name as array index. But which is not real time CPU Utilization. The awk script sums the total CPU and memory usage for each process into an associative array named process. Monitor Your CPU Utilization using Shell Script This script will monitor your CPU utilization and send an Email alert to mentioned email address.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |