Written by

Question Jens Cheung · Aug 10, 2022

API Calling from Ensemble?

I'm trying to develop monitoring API for the following requirements:

Component status - indicates whether the component (service, process or operation) up/enabled or down/disabled, and tell if there are more than two states (e.g. retrying, suspended)

Input: component name

Output: component state

Queue depth - indicates how many messages are in a queue.

Input: queue name

Output: number of messages currently in the queue

Last activity date - indicates the last time that a message was received by a component

Input: component name

Output: a date/time which corresponds to when the component last received a message 

I went through Monitoring InterSystems IRIS Using REST API doco but it seems mostly backend. Is anyone or resource is working on fetching data from the interface? Any feedback is appreciated. 

Product version: IRIS 2021.1
$ZV: Build 215

Comments

Eduard Lebedyuk · Aug 11, 2022

Component status

Use Ens.Director to get enabled/disabled and status:

set enabled = ##class(Ens.Director).IsItemEnabled(bh, .status)

Queue depth

SELECT 
  Name, 
  Count, 
  Created, 
  Active
FROM EnsPortal.Queues_EnumerateQueues()

Last activity date

Do you see it in SMP somewhere?

0
Yaron Munz · Aug 11, 2022

To get any component status, you may use:

SELECT Name, Enabled FROM Ens_Config.Item where Name['Yourname'

To check queues you may use the following sql :

select Name,PoolSize from ENS_Config.Item where Production='YourProductionName'

Then, iterate on the result set and get the queue depth by:

Set QueueCount=##class(Ens.Queue).GetCount(Name)

To check latest activiy on a component, I would go to the:

SELECT * FROM Ens.MessageHeader where TargetQueueName='yourComponentName'

and then, to check the TimeProcessed

0