getVMsPerDatastore.pl

Version 1

    I noticed Alan Renof's How many VMs on your Datastores ? article today and realized I had written something similar a few months back but forgot to publish. This script will retrieve all datastores from either ESX(i) or vCenter host and extract the number of VM(s), % free and the datastore type.

     

    Requirements:

    ESX(i) 3.5 or 4.0

    vCenter 2.5 or 4.0

    vSphere SDK for Perl or vMA 4.0

     

    Sample Execution:

     

    ./getVMsPerDatastore.pl --server reflex.primp-industries.com --username primp
    
    Datastore                                        % Free              # of VMs        Datastore Type
    -----------------------------------------------------------------------------------------------------
    dlgCore-NFS-bigboi.VM-Backups                    41.2                3               NFS
    -----------------------------------------------------------------------------------------------------
    dlgCore-iSCSI.test                               48.6                1               VMFS
    -----------------------------------------------------------------------------------------------------
    himalaya-local-SAS.Constellation                 20.5                10              VMFS
    -----------------------------------------------------------------------------------------------------
    himalaya-local-SAS.Savvio                        46.2                23              VMFS
    -----------------------------------------------------------------------------------------------------
    himalaya-local-SATA.RE4-GP:Boot                  48.2                0               VMFS
    -----------------------------------------------------------------------------------------------------
    himalaya-local-SATA.RE4-GP:Storage               49.3                31              VMFS
    -----------------------------------------------------------------------------------------------------
    dlgCore-NFS-bigboi.VM-Backups                    41.1                0               NFS
    -----------------------------------------------------------------------------------------------------
    esx40-1-local-storage                            98.7                0               VMFS
    -----------------------------------------------------------------------------------------------------
    esx40-2-local-storage                            98.1                0               VMFS
    -----------------------------------------------------------------------------------------------------
    esxi40-1-local-storage                           98.1                2               VMFS
    -----------------------------------------------------------------------------------------------------
    himalaya-iSCSI-starwind.esx-devCluster           97.6                2               VMFS
    -----------------------------------------------------------------------------------------------------