[OCI-DWH][MySQL] Get the VMware Cluster Associated with a SAN Storage Array

A random but fun NetApp OnCommand Insight DataWarehouse MySQL query that returns the VMware cluster that is associated with a storage array where it's storage array to one cluster (but you can remove the outer select to get more detail.)

SELECT
  'Storage' AS 'Storage',
  `Storage Array`,
  `VMware Cluster`
FROM (

SELECT
  GROUP_CONCAT(DISTINCT name) AS 'Storage Array',
  clusterName AS 'VMware Cluster',
  count(*) AS 'Count of Storages Serving This Cluster'
FROM (
  SELECT DISTINCT s.name, hv.clusterName FROM hv_server AS hv
  JOIN hv_lun_to_volume AS hvl ON hvl.hostId = hv.hostId
  JOIN storage AS s ON s.id = hvl.storageId
) AS t
WHERE clusterName LIKE '%TAG%'
GROUP BY clusterName
ORDER BY 1

) AS t2
WHERE t2.`Count of Storages Serving This Cluster` = 1;



Comments