Written by

Question Luk De Voght · Oct 24, 2019

SQL query to list all items in a production and their status

Hello,

Is there a way to list all items in a production (incl their status/color) by using a sql query? This is for monitoring purposes. 

Thank you in advance!

Regards,

Luk

Comments

Eduard Lebedyuk · Oct 24, 2019

You'll need a SQL procedure to return status. I haven't found it already SQL enabled.

ClassMethod ItemStatuses(pName, pIsRunning, pEnabled, pID) As %String [ CodeMode = expression, SqlProc ]
{
##class(EnsPortal.Utils).ItemStatuses(pName, pIsRunning, pEnabled, pID)
}

After that just query Ens_Config.Item:

SELECT
  ID,
  ClassName,
  Name,
  Enabled,
  ItemStatuses(Name, 1, Enabled, Id) Status
FROM Ens_Config.Item

Parameter pIsRunning means a running production.

Procedure returns comma-separated info about host status and io status.

0
Luk De Voght  Oct 24, 2019 to Eduard Lebedyuk

Thx for the quick answer. I am quite new to Ensemble. Where do I add the class method? 

0
Eduard Lebedyuk  Oct 25, 2019 to Luk De Voght

You need to create a class, for example. Test.EnsUtils, in it add this class method.

After that execute the query above (name of the sql procedure would be Test.EnsUtils_ItemStatuses)

0