Wednesday, September 5, 2012

Dstat Logging


To log the data in a csv format so that it can be used later for processing & generate graphs

dstat -ts --top-io --top-bio --noheaders --nocolor --output /tmp/dstat.csv 5 > /dev/null &

The main output is redirected to /dev/null, which means it won't get 
written anywhere.  Instead you'll get a CSV file at /tmp/dstat.csv.


Schedule it via cron every minute


#  Run dstat and log the reports

* * * * * root dstat -ts --top-io --top-bio --noheaders --nocolor 5 3 >> /var/log/dstat.txt


If you prefer a log of the data in CSV format, put this into the file instead:


#  Run dstat and log the reports

* * * * * root dstat -ts --top-io --top-bio --noheaders --nocolor --output /var/log/dstat.csv 5 3 > /dev/null


Rotate the created log

If you plan to leave the dstat logger running (and aren't just going to run it for a day or so to check on a burst of disk activity) you'll want to rotate its log occasionally to keep it from getting too big.
To that end, create a file for editing at "/etc/logrotate.d/dstat" and put the below entry to this.
/var/log/dstat.csv {
  rotate 5
  weekly
  compress
  missingok
  notifempty
}

Also
use "iotop" & "vmstat 1"
run vmstat 1 and watch the bo (buffer out) column.
If it's a userspace process you may see it with "iotop".

No comments:

Post a Comment