How to collect esxtop batch data for ESXi performance troubleshooting
On an SSH session to the ESXi host, run:
esxtop -b -a -d <interval> -n <number of samples> > /vmfs/volumes/<datastore>/esxtopOut.csv
where:
-b : batch mode
-a : collect all metrics
-d : sampling frequency in seconds
-n : total number of samples
<datastore> is a vmfs datastore
Note: Make sure there is enough free space available on the location from where the command is running and on the datastore where the output file saved. Also make sure there is no performance issue on the datastore where the output file is saved.
To include host name and timestamp of collection within the output file name, run:
esxtop -b -a -d <interval> -n <number of samples> > /vmfs/volumes/<datastore>/esxtop-$(hostname)-$(date +"%FT%H:%M").csv
e.g. to collect 300 esxtop data samples at 2 second intervals (= 600 second /10 minutes coverage), run:
esxtop -b -a -d 2 -n 300 > /vmfs/volumes/<datastore>/esxtop-$(hostname)-$(date +"%FT%H:%M").csv
where <datastore> is a vmfs datastore
Notes:
An interval of 2 seconds (-d 2) is generally a good choice to observe fine-grain performance patterns
An interval of 5 seconds (-d 5) is generally preferable where data needs to be collected for a longer period of time
For additional information on esxtop batch mode, see: vSphere Monitoring and Performance