Monitoring the device load factor

I’d like to bring the device load factor into ignition itself as a tag. Is this possible?

1 Like

Id like to do this as well, did you find a solution to this?

I’m afraid I did not find a solution.
It makes total sense to be able to monitor this and initiate an alarm under certain conditions.

Is still not possible to have this info?

Nothing has changed at this time.

Keep in mind that device load factor is not definitive. It only accounts for subscriptions. Tag writes, transaction groups in “OPC Read” mode, and any use of system.opc.* are not reflected in the load numbers, other than to the extent they impact the request/response round trip times.

Still no solution?

The diagnostic nodes are available in the OPC UA address space starting in 8.1.6.

For those not at 8.1.6 yet though, I got this from Travis (modified to be a function).
Bonus points if you can tell me how to get the number of tags subscribed to a Device… or how I can find out how to do this using the SDK doco. I couldn’t see the IgnitionGateway class within the javadocs :frowning:

def getDeviceLoadFactor(deviceName):
	"""
	Description:
		Gets the load factors for each Device/PLC and writes these into a dataset tag within each PLC's UDT instances.
	    This function must be called from the gateway context. It will not run in any other context (i.e. Designer or Client)
	
	Arguments:
		deviceName: the name of the device to get the load factor(s) for
	
	Return:
		A dictionary of device name and metrics which is a dictionary of scan rates and load factors
	"""
	from com.inductiveautomation.ignition.gateway import IgnitionGateway
	import traceback
	
	context = IgnitionGateway.get()
	dm = context.getModule("com.inductiveautomation.opcua").getClass().getClassLoader().loadClass("com.inductiveautomation.ignition.gateway.opcua.OpcUaModule").server.getDeviceManager()
	
	deviceObj = dm.getDevice(deviceName)
	metrics = deviceObj.getPollingMetrics().get()
	cr = metrics.concurrentRequests
	rsl = metrics.rateStatsList
	loadFactors = {}
	for r in rsl:
		hg = r.histogram.getMedian() / 1000000
		rq = r.requestCount
		rate = r.rate
				
		loadFactor = round(((hg * rq / cr) / rate) * 100)
		
		loadFactors[rate] = loadFactor

	deviceMetrics = {'device': deviceName,
					 'metrics': loadFactors}
		
	return deviceMetrics
1 Like

Not that our Javadocs are complete, but none of this is part of the SDK, it’s all private internal hacking, so there’s no expectation you should be able to find docs or get help doing any of this.

I figured as much. I guess you can break lots of things with the IgnitionGateway class :slight_smile: