Ever been bugged by Apps team to pull up stats in a jiffy while they do the performance testing? Here is the solution to it.
Stats for CPU, MEM & IOSTAT :
A) If stats needs to be collected in seconds. The following collects logs every two seconds.
# vi stats.ksh
while [ true ]
do
sleep 2
iostat -t >> /sheenz_perf/iostat.test.out
sar >> /sheenz_perf/sar.test.out
mpstat >> /sheenz_perf/mpstat.out
done
:wq!
B) If stats needs to be collected in minutes. Cron is set for 5 minutes.
#vi stats.ksh
iostat -t >> /sheenz_perf/iostat.test.out
sar >> /sheenz_perf/sar.test.out
mpstat >> /sheenz_perf/mpstat.out
:wq!
#crontab -e
5,10,15,20,25,30,35,40,45,50,55 * * * * /stats.ksh
:wq!
No comments:
Post a Comment