login vsi company logo login vsi company logo 250x40

 

Get the best possible VDI performance, density and availability with Login VSI
Our Solutions

  • Home
  • Blog
  • Login VSI
  • Cleaning up esxtop log files using PowerShell - Login VSI Tips and Tricks

Cleaning up esxtop log files using PowerShell - Login VSI Tips and Tricks

Cleaning up esxtop log files using PowerShell - Login VSI Tips and Tricks

Every now and then when doing large scale tests using Login VSI or collecting live performance data I use VMware's esxtop tool to give me a detailed insight to what’s going on at the host. While esxtop provides great insights, sometimes it’s just a little bit too much information. This got me thinking, how can I quickly sanitize the log file so it only contains information that is actually relevant for me at this moment?

And, of course, the first thing that comes to mind is a few lines of PowerShell. I simply import the csv file collected using esxtop and export it again containing only the columns of information I like. So let’s import the esxtop logfile using the Import-CSV command, select the data I like using select-object and throw it out again using export-csv.

cleaning up esxtop log files using powershell error

Hmmm, what’s happening here? This should have been a fairly straight forward. Analyzing it a bit further, I found out that this is because there is a comma ending every line.

cleaning up esxtop log files using powershell error comma

Luckily PowerShell allows me to fix that before I feed the content to import-csv. While experimenting, I figure at this point it’s probably best to create a simple script that does the following:

  • Point to the esxtop log that I would like to filter
  • Import the “broken” csv file
  • Remove the last character from every line
  • Import the “fixed” CSV file
  • Select the counters of my choice
    • *\Physical Cpu(_Total)\% Util Time
    • *\Physical Disk Adapter(vmhba0)\Commands/sec
    • *\Physical Disk Adapter(vmhba0)\Reads/sec
    • *\Physical Disk Adapter(vmhba0)\Writes/sec
  • Write it to a new file (export.csv)
  • Clean up
Write-Host Select file
$fd = New-Object system.windows.forms.openfiledialog
$fd.MultiSelect = $false
$fd.showdialog()
$fd.filenames
Write-Host Read file
$lines=@()
$text = Get-Content -Path $fd.filenames
$text | %{ $lines += $_.SubString(0,$_.Length-1) }
$FixedFilename = $fd.filenames -replace ".csv", ".fixed"
$FilteredFilename = $fd.filenames -replace ".csv", ".filtered"
Write-Host Write fixed logfile
Set-Content -Path $FixedFilename -Value $Lines
Write-Host Read fixed logfile
$csv = import-csv -path $FixedFilename
Write-Host Write filtered logfile
$csv | select-object "*\Physical Cpu(_Total)\% Util Time", "*\Physical Disk Adapter(vmhba0)\Commands/sec", "*\Physical Disk Adapter(vmhba0)\Reads/sec", "*\Physical Disk Adapter(vmhba0)\Writes/sec" | export-csv  export.csv -notypeinformation
Write-Host Delete temp files
remove-item $FixedFilename 

For those of you who have their regional settings setup in a way that Excel does not require the comma fix, that’s great! Otherwise you can now live knowing that your log files will be a lot smaller :-).

Also, make sure to read this blog about PowerShell.

 


 

Start using Login VSI today

Our industry-standard software is built to help you avoid problems, lower costs and improve performance. Request a Quote or get your free Trial below, and benefit from our award-winning services.

Free Price Request  Your Free Trial

 


About the company Login VSI

The company Login VSI provides end-user performance insights for virtualized desktop and server-based computing environments. Enterprise IT departments use flagship product Login VSI (for load testing) and Login PI (for continuity testing) in all phases of their virtual desktop deployment—from planning to deployment to change management—to build and safeguard a good performance, a high availability, and (as a result) a good and consistent end-user experience. For more information about Login VSI or for a free test license contact us.

About the author

Mark Plettenberg (@markplettenberg) is a product manager of Login VSI and has played a critical role in the development and growth of Login VSI. Ask Mark about motorcycle mechanics and breaking/repairing anything and everything that has a power plug.


Tags: How-to, Login VSI, VMware, Load Testing, Best Practices, Support, Scripts

Popular Blogs

Login VSI Blog - Ongoing Effects CPU Flaws

The Ongoing Effects of Intel CPU Flaws

The Ongoing Effects of Intel CPU Flaws Over the last year, we’ve seen many Intel CPU hardware flaws come to light and when news first broke about Meltdown & Spectre there was a lot of panic: "should we patch?", "What’s the performance impact?", "Can we still rely on this hardware?" Continue Reading
Login VSI Blog - How-To Update, Protect Against RIDL, Fallout MDS Vulnerability

How-To: Update, Protect Against RIDL, Fallout MDS Vulnerability

RIDL & Fallout MDS vulnerabilities, impact on VDI performance & actions to take. FAQs we’re receiving & updates on performance tests executed to patch flaws Intel calls “Microarchitectural Data Sampling (M.D.S.)” aka: Rogue In-Flight Data Load (RIDL), Fallout, ZombieLoad & Store-to-Leak Forwarding. Continue Reading
Login AT Express offers Application Compatibility Testing for up to 50 applications for FREE

[Press Release] Login VSI introduces free license for award winning solution, Login AT

Login AT Express offers Application Compatibility Testing for up to 50 applications for FREE Atlanta, USA, May 22, 2019: Login VSI, the industry standard for VDI and SBC performance testing, announced today the availability of a new, free version of Login AT for Bulk Application Compatibility Testing. Continue Reading
Login VSI Blog - Updating to Windows 10 1903? Make Sure to Test!

Updating to Windows 10 1903? Make Sure to Test!

Updating to Windows 10 1903? Make Sure to Test! It’s that time of the year again. Microsoft have released their spring update and the first IT-Pro’s are getting ready to move their VDI environment over. Continue Reading
Login VSI - Blog - Login VSI Help Center Blog Teaser Image - Improvements & Update Notifications

Login VSI Help Center – Improvements & Update Notifications

Login VSI announced the release of the Knowledge Center in June of 2017. Since then the utilization of the platform has evolved dramatically. In this blogpost we introduce a few of these improvements and updates. Continue Reading
Login VSI Blog - LVTE 2109 - Technology Advocates & Experts

Login VSI Technology Advocates and Experts 2019

About a year ago Login VSI, the industry standard in VDI performance testing, announced a new program Recognizing those individuals that have built and displayed extensive knowledge of the Login VSI software solutions, and visibly contribute to the End-User Computing (EUC) Community. Continue Reading
Cookie Settings