Any way to log the live data of (top, iotop, iostat) outputs on daily basis

710 Views Asked by At

Recently I face an issue in my java application that is running in jboss eap 7.

All the process that are forked by my java application is hung and it's not running. When I debugged further, I found that the cpu is utilised completed by some process and there is no cpu for my java application. When I looked the sar report of the linux server I could see "iowait" is very high (around 96 % to 98 %)

Is there any way to find which process is consuming this much of iowait and is there any way I can log the output of (top, iotop, iostat) on daily basis to find the root cause until this issue resolves...?

Kindly suggest me to find the root cause, thanks in advance...

1

There are 1 best solutions below

0
On BEST ANSWER

Much like top the utility iotop has much in common with top including the flags to make it run in batch mode, the option to force it to do only so many iterations. You can therefor have a cron job run every so many minutes and have the output of iotop appended to a file. Unfortunately iotop does not have any date timestamp at all so you might want to add that with something like this (this onlu outputs the date at the beginning of each run of iotop):

iostat -b -n 1 | awk 'NR==1 {print strftime()}; {print}' >> logfile

You could have that run every 10 minutes by a cron job where the minute filed would be */10.