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.

Icon for VMAN Datastore Name

Hello SWQL Ninjas!

I'm trying to identify where to pull the icon status from for VMware datastores within the VMAN product. For Nodes within Orion core this is found in the [Orion.Nodes].StatusIcon column, however, the same column does not exist within the [Orion.Vim.Datastores] table. 

I see the following options under [Orion.Vim.Datastores]:

     StatusDescription (Null values)

     StatusIconHint (Null values)

     StatusLED (Null values)

     Status (Int values)

Obviously, the first three columns are useless.  The "Status" column will require a lookup table and further logic via a case statement matching up the given value with the meaning and then linking that to the appropriate .gif file. I think I found a table that can be used in the Orion core db [Orion.StatusInfo]. 

Now for my questions...Is this the only option for pulling in the datastore icons or is there a better way?  If this is the only option, does anyone have the logic already before I dive in? I know Solarwinds is doing this in the backend somehow because when you hover on the datastore name (pulled from DetailsUrl) there is a status icon showing.

Related question, is there an ERD available for the Solarwinds Databases (including all products)? I found a thread from around 2014 that didn't look promising, I'm hoping four years has allowed for a better response.

Code included below for clarity - I'm just trying to get a view of datastores with low space that I can customize further down the road. Screenshot of query attached, the names are blocked out for obvious reasons.

SELECT d.Name, Type, Accessible as [Available],

    CASE

        WHEN (d.Capacity/1024/1024/1024/1024) > 1 THEN (TOSTRING(ROUND(d.Capacity/1024/1024/1024/1024,2))+ ' TB')

        WHEN (d.Capacity/1024/1024/1024) > 1 THEN (TOSTRING(ROUND(d.Capacity/1024/1024/1024,2))+ ' GB')

        WHEN (d.Capacity/1024/1024) > 1 THEN (TOSTRING(ROUND(d.Capacity/1024/1024,2))+ ' MB')

    END AS [Datastore Size],

    CASE

        WHEN (d.FreeSpace/1024/1024/1024/1024) > 1 THEN (tostring(ROUND(d.FreeSpace/1024/1024/1024/1024,2))+ ' TB')

        WHEN (d.FreeSpace/1024/1024/1024) > 1 THEN (TOSTRING(ROUND(d.FreeSpace/1024/1024/1024,2))+ ' GB')

        WHEN (d.FreeSpace/1024/1024) > 1 THEN (TOSTRING(ROUND(d.FreeSpace/1024/1024,2))+ ' MB')

    END AS [Free Space],

    ROUND(d.SpaceUtilization,2) as [% Used],

    CASE

        WHEN (d.ProvisionedSpace/1024/1024/1024/1024) > 1 THEN (tostring(ROUND(d.ProvisionedSpace/1024/1024/1024/1024,2))+ ' TB')

        WHEN (d.ProvisionedSpace/1024/1024/1024) > 1 THEN (TOSTRING(ROUND(d.ProvisionedSpace/1024/1024/1024,2))+ ' GB')

        WHEN (d.ProvisionedSpace/1024/1024) > 1 THEN (TOSTRING(ROUND(d.ProvisionedSpace/1024/1024,2))+ ' MB')

    END AS [Provisioned],

    ROUND(d.ProvisionedSpaceAllocation,2) as [% Provisioned],

    d.DetailsUrl AS [_linkfor_Name]

FROM Orion.Vim.Datastores AS d

--WHERE d.Name LIKE '%${SEARCH_STRING}%'

ORDER BY [% Used] DESC

Thanks in advance!

  • Hi, getting the datastore icon is actually quite easy, just add the following to the query to get the link:

    '/Orion/StatusIcon.ashx?entity=Orion.VIM.Datastores&status=' + ToString(d.Status) + '&size=Small' AS [_IconFor_Name]
  • I knew I had to be missing something, thank you lukas.cerny!  Added the line and it worked emoticons_happy.png

    Posted the final code in case anyone stumbles upon this down the road.  Just uncomment line 23 for the search query.

    SELECT d.Name, Type, Accessible as [Available],

        CASE

            WHEN (d.Capacity/1024/1024/1024/1024) > 1 THEN (TOSTRING(ROUND(d.Capacity/1024/1024/1024/1024,2))+ ' TB')

            WHEN (d.Capacity/1024/1024/1024) > 1 THEN (TOSTRING(ROUND(d.Capacity/1024/1024/1024,2))+ ' GB')

            WHEN (d.Capacity/1024/1024) > 1 THEN (TOSTRING(ROUND(d.Capacity/1024/1024,2))+ ' MB')

        END AS [Datastore Size],

        CASE

            WHEN (d.FreeSpace/1024/1024/1024/1024) > 1 THEN (tostring(ROUND(d.FreeSpace/1024/1024/1024/1024,2))+ ' TB')

            WHEN (d.FreeSpace/1024/1024/1024) > 1 THEN (TOSTRING(ROUND(d.FreeSpace/1024/1024/1024,2))+ ' GB')

            WHEN (d.FreeSpace/1024/1024) > 1 THEN (TOSTRING(ROUND(d.FreeSpace/1024/1024,2))+ ' MB')

        END AS [Free Space],

        ROUND(d.SpaceUtilization,2) as [% Used],

        CASE

            WHEN (d.ProvisionedSpace/1024/1024/1024/1024) > 1 THEN (tostring(ROUND(d.ProvisionedSpace/1024/1024/1024/1024,2))+ ' TB')

            WHEN (d.ProvisionedSpace/1024/1024/1024) > 1 THEN (TOSTRING(ROUND(d.ProvisionedSpace/1024/1024/1024,2))+ ' GB')

            WHEN (d.ProvisionedSpace/1024/1024) > 1 THEN (TOSTRING(ROUND(d.ProvisionedSpace/1024/1024,2))+ ' MB')

        END AS [Provisioned],

        ROUND(d.ProvisionedSpaceAllocation,2) as [% Provisioned],

        d.DetailsUrl AS [_linkfor_Name],

        '/Orion/StatusIcon.ashx?entity=Orion.VIM.Datastores&status=' + ToString(d.Status) + '&size=Small' AS [_IconFor_Name]

    FROM Orion.Vim.Datastores AS d

    --WHERE d.Name LIKE '%${SEARCH_STRING}%'

    ORDER BY [% Used] DESC