Linux vmstat Recipe

  1. Run vmstat in the background with a 5 second interval:
    sh -c "date >> nohup.out && (nohup vmstat -tn 5 > diag_vmstat_$(hostname)_$(date +%Y%m%d_%H%M%S).txt &); sleep 1; cat nohup.out"
  2. Check for any errors running the above commands in your terminal. Some versions of Linux do not support the -t flag so the above command will give an error. If so, change to -n.
  3. Reproduce the problem.
  4. To stop collection, kill the vmstat process. For example:
    pkill -f vmstat
  5. Upload diag_vmstat_* and nohup.out

For background, see Linux vmstat.