VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
1 Replies Last post: Oct 5, 2008 9:54 AM by LucD  

VM File Monitoring posted: Oct 2, 2008 3:19 PM

Click to view SetClear's profile Enthusiast 24 posts since
Aug 24, 2007

So, heres another scripting format to get use to...

I would like to do what I have been doing in the form of perl from the console from a VM offloading the processing from the host.

What I am doing presently is recursivly reading through /vmfs/volumes/.. to find each vmx file and verifying that all pointers to the vmdk's etc are all readable.

The reason I have to do this is I had someone re-present a LUN to another VM as a raw device and the device got formatted as ntfs whihmade the ESX host unable to manage the volume.

I would have never known about this if it wasnt that one of the systems was rebooted. the power init forced esx to reread from the lun which it couldnt do. The other systems that were also on the volume but not rebooted were fine and would remain so until the systems were rebooted, power cycled, etc..

So, now I have been told by management that I need to monitor this.

Does anyone have a starting point for me using powershell. I have used perl for the longest time and quite good at vbs.. but powershell is all new...

Thanks in advance!

Bill

Re: VM File Monitoring

1. Oct 5, 2008 9:54 AM in response to: SetClear
Click to view LucD's profile Champion 2,431 posts since
Oct 31, 2005
To start you of, in the VITK it is quit easy to get a list of each VM and it's corresponding .VMX file.
$vmsImpl = Get-VM
$vms = $vmsImpl | Get-View
foreach($vm in $vms){
  Write-Host  $vm.Name $vm.Config.Files.VmPathName
}


Carter has recently added the function get-tkevmx to the VI Toolkit Extensions.
See how can I read the contents of *.vmx file.

From there you can get at all the entries in the .VMX file.

How would you proceed further to validate that a raw disk is not (mis)used by multiple guests ?
I could imagine situations where it is intentional (MS Clustering for example).

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities