admin
Immortal
Immortal

Script to display NFS Stats per-VMDK

I have written a small python script to parse vscsiStats histograms and display the data like the esxtop VM (v) screen. Posting the script here since some other people may find it useful.

Jeremy

Tags (2)
0 Kudos
38 Replies
lamw
Community Manager
Community Manager

Very cool! vscsiStats is a very useful tool, would be great to see this integrated into vCenter performance charts.

Generally script samples are posted under VMware Sample Code ... though there not a section for python. Nonetheless, very nice script!

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
admin
Immortal
Immortal

Here is an updated version of the script which should hopefully work on classic ESX, I only tested the first version on ESXi 4.0 which had a newer version of python (2.5).

0 Kudos
SparkFan
VMware Employee
VMware Employee

Hi Jeremy,

The script is great!

-Spark

0 Kudos
m0ps
Enthusiast
Enthusiast

it works on ESX4.0u1. many, many thx

best regards, m0ps

best regards, m0ps
0 Kudos
fletch00
Enthusiast
Enthusiast

Great script - I wrote some similar scripts to help centralize and quantify the IO load per VM on my NFS datastores to prioritize VM realignments.

I just filed a feature request SR 1471853531"Please bring the vscsistats (/usr/lib/vmware/bin/vscsiStats) into VC and align with existing APIs.

Currently the command offers a wealth of stats but only on the command line and only per ESX host.

Centralizing them into VC would provide:

1) IO stats per VM on NFS datastores (unavailable via esxtop)

2) Provide standard Trending, Alerting etc

3) Help answer questions like which VMs need to be storage vMotioned to less loaded datastores

thanks"

VCP

VCP5 VSP5 VTSP5 vExpert http://vmadmin.info
0 Kudos
fletch00
Enthusiast
Enthusiast

VMWare rejected my "Feature Request" SR - saying the SR system did not accept feature requests.

To which I replied "then why does your SR form include "Feature Request" as a category"?

It turns out there is no official way to file and track a feature request

Way to go VMWare (platinum) support

VCP

VCP5 VSP5 VTSP5 vExpert http://vmadmin.info
0 Kudos
mlubinski
Expert
Expert

can you please explain how to run this script on ESX4?

I uploaded it into datastore, and did chmod 700 nfstop, but when I run ./nfstop it says: Please install the /sbin/vscsiStats binary.

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points

[I]If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points[/I]
0 Kudos
m0ps
Enthusiast
Enthusiast

edit nfstop file end replace path to vscsiStats binary from /sbin/vscsiStats to /usr/lib/vmware/bin/vscsiStats

best regards, m0ps

best regards, m0ps
0 Kudos
mlubinski
Expert
Expert

Nice, it works now, thank you Smiley Happy

If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points

[I]If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points[/I]
0 Kudos
gicti
Enthusiast
Enthusiast

Hi

Does this work on ESX 3.5 U4 ?

I have been searching in the community

"G"

0 Kudos
mastrboy
Contributor
Contributor

0 Kudos
fletch00
Enthusiast
Enthusiast

I am out of the office until March 1

Checking email only occasionally

VCP5 VSP5 VTSP5 vExpert http://vmadmin.info
0 Kudos
titaniumlegs
Enthusiast
Enthusiast

The versions posted above do not run in ESX 3.5 due to the version of Python (Py 2.2 in ESX 3.5, Py 2.4 in ESX 4.0 and Py 2.5 in ESXi 4.0). We made a couple changes here at NetApp and got it to work, but when I wanted to post it back I was informed that we have certain legal procedures to follow when we modify somebody else's code and wish to re-publish. We're now working through that so I can share it. The changes are minor and anybody reasonably proficient in Python could figure it out, so have at it, or stay tuned.

Peter

Share and enjoy! Peter If this helped you, please award points! Or beer. Or jump tickets.
0 Kudos
gicti
Enthusiast
Enthusiast

Hi,

Great work on this tool !

When trying to exit/stop the script is there a recommend procedure ? ie. do we have to stop the data collection of vscsistats ?

Thanks in Advance,

G

0 Kudos
Tentakel777
Contributor
Contributor

Hi titaniumlegs ,

any updates on running this script on esx 3.5? it would be great if you can post an updated version for esx 3.5!

Thanks

0 Kudos
Protoburger
Contributor
Contributor

Just go to the line 345 and remove the sorted function:

< for vm in sorted(curr.keys(), mbpsCmp):

---

for vm in curr.keys():

This will make it work.

0 Kudos
titaniumlegs
Enthusiast
Enthusiast

Or you can use sort instead of sorted. Sort sorts an array in place. Sorted sorts a copy of the array, leaving the original as it was. For this script, it doesn't make much difference.

The other thing is some int variables need to be long.

Working copy attached.

Tested on

# vmware -v

VMware ESX Server 3.5.0 build-123630

Share and Enjoy!

Share and enjoy! Peter If this helped you, please award points! Or beer. Or jump tickets.
0 Kudos
gicti
Enthusiast
Enthusiast

Thanks a bunch for this fix (beer is on me!), I'm really suprised vmware does not have this built into the product.....

What is the correct method to exit this script ? I'm worried about vscsistats staying running in the background and chewing up resources and/or space if there is any data written to disk...

"G"

0 Kudos
Protoburger
Contributor
Contributor

/usr/lib/vmware/bin/vscsiStats -x

0 Kudos