Question
· 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

Discussion (5)0
Log in or sign up to continue

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.