ron9999
Contributor
Contributor

Advanced VM Report

Jump to solution

Hello together.

I have found a very useful PowerCLI Script for reporting virtual servers.

(see attached file) Original by LucD

But i need three more fields inside the report to make it perfect for me.

1. a seperate field with total size of a snapshot

2. a seperate field with total size of a vm (sum of vmdk files, memory, snapshot files and so on)

3. Powerd OFF / Powered ON VM as well as Templates with whole file size

I have no idea how to implement it. Can someone help me.

That would be very nice.

Thanks.

Regards

ron9999

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

That comes from the templates.

Try it with this version, it retrieves the capacity and free space in a different way which is valid for VMs and templates.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
31 Replies
LucD
Leadership
Leadership

Hi Ron,

Quick question, are your guests running on vCenter 4.x/ESX(i) 4.x ?

For the snapshot size there are several ways of calculating the size.

Have a look at my yadr – A vdisk reporter post. The post explains how I calculate snapshot sizes, which is not the way PowerCLI handles it with the Get-Snapshot cmdlet.

Which method do you prefer ?

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

Hi LucD.

Thanks for the quick response.

We use vCenter 4.0 U1 und ESXI 4.0 U1 but we plan the upgrade to the version 4.1 for later time.

For now the 4.0 U1 version is the only one.

If it is possible i prefer the get-snapshot cmdlet.

0 Kudos
LucD
Leadership
Leadership

Attached a new version of the script.

For the snapshot size I took the first snapshot, but this can easily be changed to show the cumulative size of all snapshots.

Not sure what you mean with the templates ?

A lot of the cmdlets used in the script won't work with templates.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

Thanks a lot again.

As i understand in your script the VMTotalSize is the UsedSpace of a VM. Is it possible to add an additional field with the VMTotalSize Provisioned Space? I need both information.

In both VMTotalSize fields (Used and Provisioned Space) i need the cumulative size of all snapshots. I've tried it but with now results :-(.

Besides the VM (Power On/OFF) we have many templates (vmtx extensions) for faster deployment of new VM's. But this templates use storage space and i need only the information how much in total (Used and Provisioned Space) and which OS is installed (Windows, Solaris, Linux not exactly). Maybe it is not possible.

0 Kudos
LucD
Leadership
Leadership

Ok, I adapted the script to give the values you requested.

For snapshots I made a 2nd loop in the script but the results will be in the same array.

That way the script can export the array to 1 CSV file.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

I'm little bit confused because in my output file i have many server with following field outputs

for example:

ProvisionedSpaceGB

126

UsedSpaceGB

18

VMProvisionedMB

13163050

VMUsedMB

13163050

How can it be that the seperate value show me the correct file size but the total size (VMProvisionedMB and VMUsedMB) have the same values? Should the total VMUsedMB value not be smaller than the VMProvisionedMB value?

0 Kudos
LucD
Leadership
Leadership

The only explanation is that these hard disks on the guests that show the same value are not in the thin but in the thick format.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

But these four values are from one vm. I think i know the problem, because the servers with this problems have physical RDM's connected.

Do you use another way to collect the information for the VMusedMB value then for the UsedspaceGB inside your script?

Maybe a new field only with usedspace for RDM devices near the used space for vmdk files is necessary.

What is your opinion?

0 Kudos
LucD
Leadership
Leadership

Ok, must have misread your reply.

The VMUsedMB and VMProvisionedMB properties are calculated from the used disk space over all datastores (should you have guests that have files over multiple datastores). See the description in the VirtualMachineStorageSummary object.

The ProvisionedSpaceGB property is calculated from the sizes returned by the Get-HardDisk cmdlet. This size doesn't take into account any eventual snapshots.

The UsedspaceGB property is calculated from the [VirtualMachineFileLayoutExFileInfo|VirtualMachineFileLayoutExFileInfo[]] object where only the 'diskExtent' files are taken. These are the -flat/-delta/-s/-rdm/-rdmp.vmdk files.

Up to you to decide what you actually want to see.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

Hi LucD.

that is a very difficult decision. I need the information of Provisioned und UsedSpace (seperated in detail of each vm) -flat/-delta/-s/-rdm/-rdmp.vmdk and Memory space and in total of each vm. It is not necessary searching the space over all datastores because all vm's are located only on one datastore.

I hope my wish is practicable.

0 Kudos
LucD
Leadership
Leadership

That should be the values present in the VMUsedMB and VMProvisionedMB properties.

Unless you see different values. In the vSphere client ?

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

Yes.

The VMUsedMB and VMProvisionedMB values are the correct one, if the snapshot files are implemented in the total size. Is it possible to seperate the ProvisionedSpace and UsedSpace field only for the vmdk files (including rdm) in sum like in the other script? I the old script the rdm information was not existing.

0 Kudos
LucD
Leadership
Leadership

You mean the sum of all the -flat/-delta/-s/-rdm/-rdmp.vmdk together and then another sum with the other files ?

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

Like the fields ProvisionedSpaceGB and UsedSpaceGB in the old script with included RDM Space (All virtual disk sizes of a vm). For the snapshot size there was an seperate field like Memory in the script. The sum of the whole VM (VMProvisionedTotal, VMUsedTotal) with information from fields ProvisionedSpaceGB, UsedSpaceGB, MemorySize, Swapsize, Snapshotsize and so on. In the last version of you script the values of VMProvisionedTotal and VMUsedTotal were OK only the ProvisionedSpaceGB and UsedSpaceGB values had no rdm information included.

I hope i described it correct and someone can understand it Smiley Happy or is not possible?

0 Kudos
LucD
Leadership
Leadership

I'm a bit confused by the latest requirements Smiley Wink

The property ProvisionedSpaceGB does contain the RDM disks.

And so does the VMProvisionedMB property.

A recap of the properties:

*) ProvisionedSpaceGB : size of space allocated for all the hard disks (including RDMs)

*) UsedspaceGB : space used by the hard disks (RDMs excluded)

*) AllSnapshotSizeMB : space used by the snapshots (as reported by Get-Snapshot)

*) VMUsedMB : Total storage space committed to this virtual machine across all datastores.

*) VMProvisionedMB : VMUsedMB plus the storage space potentially used by this virtual machine on all datastores.

Could you indicate which property needs to change and into what ?

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

Sorry that you're confused due my last desciption. Maybe my english is not very well enough to explain for what i'm need.

I will take your entries mark what i need

*) ProvisionedSpaceGB : size of space allocated for all the hard disks (including RDMs)

*) UsedspaceGB : space used by the hard disks (including RDMs)

*) AllSnapshotSizeMB : space used by the snapshots (as reported by Get-Snapshot)

*) VMUsedMB : Total storage space committed to this virtual machine (including RDMs) like UsedSpaceGB

*) VMProvisionedMB : Total ProvisionedSpace to this virtual machine (including RDMs) like ProvisionedSpaceGB

The total space include the same information of the fields ProvisinedSpaceGB and UsedSpaceGB + the Swap size , RAM size, Snapshop size (simply the whole size of a virtual server)

It is not necessary to search over all datastores.

0 Kudos
LucD
Leadership
Leadership

Afaik, there is no way to know what is actually used on a RDM disk (unless you go inside the OS that runs on the guest).

Remember that in RDM, the 'R' stands for 'raw', the hypervisor doesn't control the filesystem on a RDM.

And afaik there are no 'thin' RDM disks.

That means I see no way to get for UsedspaceGB and VMProvisionedMB the values you want.

Perhaps someone else knows of a solution.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ron9999
Contributor
Contributor

Is it not possible to extract these information (RDM and vmdk files) of UsedspaceGB and VMProvisionedMB from the VMProvisionedMB and VMUsedMB values?

For me it is not necessary to know the UsedSpace of a RDM device. These values (used and provisioned) af a rdm device can be the same but i need the seperate space field information of virtual harddisks.

0 Kudos
LucD
Leadership
Leadership

Are you now saying you want the provisioned and used space per hard disk ?

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos