![]() Upon execution, it will search all sa* file in /var/log/sa and perform basic calculation to display CPU/memory average. bash - Linux: Get CPU usage over past n minutes - Super User Linux: Get CPU usage over past n minutes Ask Question Asked 8 years, 1 month ago Modified 7 years ago Viewed 16k times 5 I want a script to tell me the average CPU usage over the past 5 minutes (and repeat every 5 minutes, likely as a cron job). ![]() ![]() # Get Average CPU/Memory Utilization History from sysstat file in /var/log/sa/*įor file in $(ls -la /var/log/sa/* | grep sa | awk '' Sysstat package is required to enable sar report on your server. So avg (sum of top command output filtered core only )/ (sum of each core frequency) asktyagi. Should be working fine on any RHEL based distribution. /proc/cpuinfo should show the real capacity of you core, not the used one, used core you can get it from top with batch mode with pid and real capacity from /proc/cpuinfo or use dmidecode or lshw which ever is available. Working on some performance related issue today and user requested average CPU/Memory utilization history on previous days, so I came out with quick script to pull the data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |