vROPS – How to find out which Clusters have inconsistent datastores mounted to the Host

All ESXi Host attached to a specific cluster should have the same amount of datastores connected to it. This is important for vMotion purposes as a VM can’t vMotion to a Host if the datastore that the VM is on is not presented to that host. In this guide, I will walk you in the process of creating a supermetric that detects which Clusters have inconsistent datastores mounted to the host. Then I will walk you through on creating a view to display clusters that have inconsistency.

STEP 1: Create the Super Metric

The logic for this Supermetric is simple. We only need one metric for the entire formula: Total Number of Datastores for Host Systems. We are going to create a formula that takes the maximum value and subtract the minimal value for the metric Total Number of Datastores. If we get a result greater than 0 than we know there is a mismatch.

For example if a cluster has 10 hosts and each host have 5 datastores, than the max and min should both be 5. When we subtract the two it should result in a value of 0 meaning they are all the same.

Max (5 Datastores) – Min (5 Datastores) = 0

Now if a cluster has 10 hosts and nine out of the ten host has 5 datastores, but one of the host has only 3 datastores connected to it. The results of the formula should return a value of 2. Meaning there are two datastores missing on at least one host.

Max (5 Datastores) – Min (3 Datastores) = 2 Datastores missing on one host

Go to Administration > Super Metrics > + to add a new Super Metric

Provide a name for the Super Metric and cut and paste the following formula below and click on save.

max(${adaptertype=VMWARE, objecttype=HostSystem, metric=summary|total_number_datastores, depth=1})-min(${adaptertype=VMWARE, objecttype=HostSystem, metric=summary|total_number_datastores, depth=1})

You should now see your super metric. Select it and click on Object Types > plus (+) sign. Select vCenter Adapter > Cluster Compute Resource as the object and click on Ok. This will give us the option to have this object show up for Clusters only.

Now we need to enable the Super Metric in our Default Policy. Go to Administration > Policies and look for the policy that has the D. This is the default policy.

Click on Policy Library Tab. Select your Default Policy and click on the Pencil icon to edit the policy.

Select Collect Metrics and Properties and look for your Super Metric. There should be two of them. Look for the one that has the Object Type set to Cluster Compute Resource and change it from Inherited to Local. Click on Save, give at least 5 minutes for the metric to show up.

STEP 2: Create the View to be used for Dashboards or Reports

Now that our Supermetric is created. We can create a view with a filter that will display if there are any inconsistent datastores found on any cluster. This view can be added to as dashboard or a report.

Let’s create a new View by going to Dashboards > Views > + sign

Provide a name for the view

Select the List option under Presentation, since we want to see a list of Clusters

Select Cluster Compute Resource as our subject

Expand Super Metrics and look for the metric we created earlier. Double click on it until it shows up under data

Next we need to filter the metric out to display only Clusters that have inconsistent datastores on the Host. Click on the Filter tab and filter the following: Supermetric is Greater than 0

Click on Save. We should now see values if any inconsistencies are found on any cluster. Make sure your view or report is pointed to vCenter Adapter > vSphere World.