This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Datastore alerts for particular datacenter

Hello, in this opportunity, I need to create a space alert for the datastores of a particular datacenter and I was trying to write a SWQL query but I couldn't find out how to relate the datastores with the datacenters.

Anyone can help me with this? or can tell me an alternative path to create an alert for datastores capacity for a particular datacenter ?

Thanks!

  • Create an alert on a SWQL query. Set the type to "Virtual DataStore" and populate the query with:

    where Datastores.Hosts.DataCenter.Name = 'YOUR_DATA_CENTER'

    Like this:

    pastedImage_0.png

  • Hey m-milligan thinks! for the quick answer!

    Just a little doubt with this method, Where I include the condition about the space?

  • You'd include it in the WHERE part of the query. The columns most likely to be of interest are DataStores.Capacity (total capacity of the Data Store in MB), DataStores.FreeSpace (remaining free space in the Data Store in MB), DataStores.SpaceUtilization (percent of Data Store used by files).

    For example, if you want to trigger an alert when a Datastore is over 80% full, you would use:

    where Datastores.Hosts.DataCenter.Name = 'YOUR_DATA_CENTER'  
    and Datastores.SpaceUtilization > 80
    group by DataStores.Uri, DataStores.DisplayName

    Like this:

    pastedImage_4.png

    (Edited 2018-04-25 15:47 to add GROUP BY clause)

  • Thanks again m-milligan!, but It seems like it's doesn't working, in the list, at the summary page of the alert configuration, datestore from other datacenters are included!

  • That's interesting. I ran the query against each of my DataCenters, and I did NOT see any duplication. Do you have any storage that's shared between DataCenters? Do you use a naming convention that causes DataStores to have the same name even though they're in different DataCenters?

    Try this query in SWQL Studio. Replace "MY_DATACENTER" with the name of each of your DataCenters. This will get the IDs of the DataStores for that  DataCenter. Are the ID's unique for each DataCenter?

    select Datastores.DataStoreID
    from Orion.VIM.Datastores
    where Datastores.Hosts.DataCenter.Name = 'MY_DATACENTER'
    and Datastores.SpaceUtilization > 80
    group by DataStores.DataStoreID

    I see that my original query caused each DataStore to appear once for each host that uses it. The query below will eliminate that duplication:

    select Datastores.Uri, DataStores.DisplayName from Orion.VIM.Datastores
    where Datastores.Hosts.DataCenter.Name = 'YOUR_DATA_CENTER'
    and Datastores.SpaceUtilization > 80
    group by DataStores.Uri, DataStores.DisplayName
  • m-milligan you were right!, I don't administrate the vCenter so I didn't know in detail the configuration and had this request from that team. The datastores the alerts shown in the summary list are shared, so you and VMAN were right.

    Thank you very much for your speed in the answers and your interest in helping.

  • (sighs with relief)

    You're welcome. Glad it is doing what you need!