A reader named Mark contacted me today and asked if there was a way to reduce the size of the batch output from an ESXTOP run. And he asks for good reason: Depending on the number of VM’s on your host, the delay between ESXTOP samplings and the number of samples you collect, using the All Stats option (-a) can yield a massive file in a short period of time. If written to a partition on your ESX Service Console you run the risk of filling the partition, and forget about actually being able to analyze the data in PERFMON or Excel. For example, on an ESX host running ~15 VM’s I produced 100MB worth of CSV using the -a switch, sampling every 15 seconds, for just under 2 hours. ESXTOP uses 10-second intervals by default; I used -d 15 to change the sampling delay. Had I went with the default my output would have been bigger.
To reduce the size of your output, you can change your sampling delay to something larger, say 30-seconds. I suppose you could also capture statistics when the host is not busy so you get fewer characters in the results, but that’s just being goofy. 😉
A better way to reduce your ESXTOP output size is to selectively include only the statistics you are interested in, and is really what Mark was asking. After all, all statistics from ESXTOP can be too many statistics, and chances are you already know what stats you are interested in. Here’s how you can narrow down the collected stats for easier analysis and smaller output:
- Enter ESXTOP in interactive mode on the Service Console by simply typing esxtop at the # prompt
- Switch to a component you are NOT interested in capturing statistics on by pressing the corresponding menu option (c: ESX cpu, m: ESX memory, d: ESX disk adapter, u: ESX disk device, v: ESX disk VM).
- Press f when viewing the component you do not want to capture. A list of fields will be displayed. You can toggle the fields on and off by pressing the letter corresponding to each field. An * indicates that the field is on. You want to turn off all of the fields you don’t want to collect.
- Repeat steps 2 & 3 for the remaining components, leaving only what you want to capture.
- Switch to the component you want to capture in batch mode and repeat step #3, except you will now enable what you want to capture.
- Press W (capital W – case sensitive) to write out the ESXTOP configuration file. You can accept the default or create new configuration files. You may want to create a CPU-only config file, memory-only, and so forth.
- Press CTRL+C to stop ESXTOP.
- Now, invoke ESXTOP in batch mode, calling your updated or new configuration file you created in step #6 using the -c switch. Here’s an example:# esxtop -b -d 30 -n 480 -c .esxtopcpustats > /tmp/esxtop_cpu_stats.csv where .esxtopcpustats is an ESXTOP config file with only CPU stats. -d sets your capture interval to 30 seconds, and -n sets the number of samples to 480 (or 4 hours with a delay of 30 seconds).
Once your capture is complete you can replay the sampling in ESXTOP using replay mode (-R), or you can copy the .csv to a Windows system and use PERFMON or Excel to analyze the stats. If using PERFMON or Excel you will notice that the system summary information displayed at the top of an interactive ESXTOP session is included in the output (console memory, console cpu, etc.). As far as I know, there is no way to disable this, nor would you want to as it includes the time stamp necessary to interpret your data.
It is possible to use the vSphere CLI or the vSphere Management Assistant (vMA) to run RESXTOP, a version of ESXTOP designed for remote administration of ESXi or ESX. You may note, however, RESXTOP from the vSphere CLI only works from a Linux client. Using either of these tools will help you to automate ESXTOP statistics collection from multiple hosts using customized configuration files.
Mark Lin says
Dear Josh:
Thank you very much for taking your time to answer my question. It is very detailed and well-explained 🙂 I really appreciate your work and I am going to work on these methods now, thanks alot 🙂
Best,
Mark Lin
Geoff White says
Try this program in Beta for reading esxtop batch mode data, it can read the very larrg CSV files, plot data that is gathered, you can even use regex queries to prune out the metrics that you want and export them to a new CSV file that is small enough to load into Excel or PERFMON, (or reload it back into esxplot)
https://vpivot.com/2009/10/21/esxtop-analysis-with-esxplot/
lloyd says
Unable to get esxtop -batch mode to use either default template /root/.esxtop310rc or custom template.
after deselect all atributes except disk A I J and then using W to default template. the following resulted in 12758 columns.
Then tried creating custom template, same result.
esxtop -b -d 15 -n 5760 -c /var/opt/esxtop/.customrc > var/opt/esxtop/srv01.csv
Has anyone really got ESX 3.5 U4 to run esxtop in batch mode and limit the # of columns?? I don’t believe its possible.
Sebastian Kayser says
Josh, this is wonderful, thanks for the great (detailled) article! Regarding the selection of the relevant columns, I’ve used the following Perl one-liner to first deselect _all_ columns and then manually selected the few ones which I was interested in via esxtop.
perl -pi -e ‘$_ = lc if /^[[:alpha:]]/’ .esxtop4rc-batch
Briefly tested on ESX4. When there are only a few columns of interest this is considerably faster (and of course much more fun 😉 than manual deselection.
Sebastian
Joshua Townsend says
Great work, Sebastian. Thanks for sharing!
Duane Smith says
Great info! Great website!
Does anyone have the final word on making batch mode use the config file? I have not been able to limit the output in batch mode and I have not seen any posts that specifically answer that question.
hg says
I wanted to pull out only the power stats and I tried what is suggested here. Disabling the stats for everything other than power and it runs fine in the interactive mode, but in batch mode it dumps all of the data instead of just showing the power usage stats. I am using ESXi version VMware ESXi 5.5.0 build-2143827. This seems to a an outstanding issue that a lot of people are facing https://communities.vmware.com/thread/472756. Can you please confirm in which version of ESXi this works as expected?
Josh Townsend says
This article is pretty old at this point – I can’t remember which version of ESX/ESXi I used. I suggest reaching out to VMware Support for help if you think you’ve found a bug.
Aleksey says
Mother Russia)))
Отличная статья, спасибо
По вопросу отображения, если кому интересно, есть возможность подгрузки этих данных в заббикс!!
через zabbix_sender с ключами -T и -i из csv