Powershell scripts for Collecting and Processing vscsistats
These scripts are meant to assist in collecting and processing vscsistats data based on operations to virtual machines disk files on a VMware ESX/i host.
The tool vscsistats is a native tool from VMware that collects information on virtual disk operations. However, the tool displays information in running totals which makes the data less useful. The main intention of these scripts is to leverage native vscsistats counters and do collections and calculations on sleep intervals which allows for outputting samples with metric per second values.
There are three scripts that are used together to get from collection to displaying data. One that runs as a job in the background collecting vscsistats output, the other that retrieves this output, and another that helps to parse and standardize the output for 3rdparty tools and viewing from powershell.
Updated 3/7/11 - update to allow for ESX/i 4.0
Updated 3/7/11 - update to fix windows xp/2003 powershell job bug
Updated 3/7/11 - changed name of get_vscsistats.ps1 to collect_vscsistats.ps1
The "not running anymore so quit" dialog refers to the script trying to receive results but the vscsistats is outputting nothing for the specified world/diskhandlid's. Any chance you're running 4.0 (prolly not)? One thing to mention with this script is that it doesn't manage which VMs and disks are being monitored. It assumes that you have ran the commands from the document to kick the monitoring process off. The script then logins into the ESX console and receives the metrics via SSH for one session and then repetitive commands every x seconds. If you log in through SSH and run the command that receives the output of a running vscsistats session, do you see anything? If not then this is why the script will report that the not running anymore.
Yes I had kicked off vscsiStats on the ESX/ESXi host first. That was my first thought based on the output from the script so I ran the vscsiStats -p all command to make sure data was being collected on the 3 virtual disks for the VM being monitored.
I just posted an updated copy of the vscsistats script that allows for ESX/i 4.0 and fixes some XP/2003 job compatibility issues. Also make sure to use "set-executionpolicy bypass" if you are getting security warnings when executing the script. Security warnings can cause the script to hang in the background as it kicks off the collection jobs.
The document was just updated to match the most recent version. The -outcsv is a requirement, and the script was renamed to collect_vscsistats.ps1 more closely reference what it really does and to be standarized across other similar ones.
Im having some problems with the script... The script is running fine, but at some point I start getting an 'error' that there is no io from vm...
I cant figure out if its a timeout or what... The shortest vscsistats i ran lasted only 6 minutes before the message came... The longest ran close to an hour...
This refers to a situation where there is either no active IO occuring, or all vscsistats sessions have ended on the esx host. Vscsistats has been a bit unpredictable for me at times in terms of length of runs. Jason Boche mentioned a 30 minute default timeout for the session, but I've seen it last longer and shorter as well. If anyone has any insight into why a vscsistats session would end without a forced stop I would be interested to hear.
For now you can kick off the command on the ESX host to start back up the session and vscsistats will continue recording the output. A management script for automagically kicking off and ensuring it is running might be needed to overcome the challenge.
jasonboche-2015
44 Posts
2411
0
Posted March 2nd, 2011 21:00
I was unable to retrieve data. When I run the script:
C:\junk\test 2 vscsistats> .\get_vscsistats.ps1 -esxip 192.168.110.5 -username root -password xxxx
It pauses for a few moments and returns:
"not running anymore so quit"
Preflight check was successful.
See attachment
1 Attachment
3-2-2011 11-35-23 PM.png
3-2-2011 11-35-23 PM.png