'sar' command in linux is a command to return CPU usage and memory usage information.
You can issue repeated option to keep it running returning the stats with specified times.
Ex: >sar 5 150
this will return the result every 5 seconds for 150 times.
some example out put is below:
21:00:56 CPU %user %nice %system %iowait %steal %idle
21:01:11 all 2.21 0.00 0.85 6.13 0.00 90.81
21:01:26 all 3.71 0.00 1.35 3.03 0.00 91.91
21:01:41 all 0.93 0.00 0.68 4.33 0.00 94.05
21:01:56 all 0.88 0.00 0.77 4.41 0.00 93.94
21:02:11 all 0.83 0.00 0.63 4.15 0.00 94.39
Average: all 15.29 0.00 4.77 32.46 0.00 47.48
21:01:11 all 2.21 0.00 0.85 6.13 0.00 90.81
21:01:26 all 3.71 0.00 1.35 3.03 0.00 91.91
21:01:41 all 0.93 0.00 0.68 4.33 0.00 94.05
21:01:56 all 0.88 0.00 0.77 4.41 0.00 93.94
21:02:11 all 0.83 0.00 0.63 4.15 0.00 94.39
Average: all 15.29 0.00 4.77 32.46 0.00 47.48
Here is what you can do to extract specific time interval from sar data file:
Sar puts its data in daily logs in /var/log/sa. So for instance, if you want to extract from /var/log/sa/sa16 file, use the –f option and then –s for start and –e for end in hh:mm:ss format:
> sar -f sa16 -s 19:00:01 -e 20:27:01
No comments:
Post a Comment