# Monitoring the device load factor

**URL:** <https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389>\
**Category:** Ignition\
**Created:** [March 16, 2018, 9:37am UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389 "2018-03-16T09:37:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![accyroy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/accyroy/32/3386_2.png) [@accyroy](https://forum.inductiveautomation.com/u/accyroy)\
**Post date:** [March 16, 2018, 9:37am UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/1 "2018-03-16T09:37:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wschauer](https://avatars.discourse-cdn.com/v4/letter/w/ecccb3/32.png) [@wschauer](https://forum.inductiveautomation.com/u/wschauer)\
**Post date:** [April 18, 2019, 2:01pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/2 "2019-04-18T14:01:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![accyroy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/accyroy/32/3386_2.png) [@accyroy](https://forum.inductiveautomation.com/u/accyroy)\
**Post date:** [April 18, 2019, 2:22pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/3 "2019-04-18T14:22:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lettierf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lettierf/32/7431_2.png) [@lettierf](https://forum.inductiveautomation.com/u/lettierf)\
**Post date:** [May 28, 2019, 12:55pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/4 "2019-05-28T12:55:59Z")

</div>

Is still not possible to have this info?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 28, 2019, 1:01pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/5 "2019-05-28T13:01:57Z")

</div>

Nothing has changed at this time.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 28, 2019, 2:00pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/6 "2019-05-28T14:00:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kghali](https://avatars.discourse-cdn.com/v4/letter/k/da6949/32.png) [@kghali](https://forum.inductiveautomation.com/u/kghali)\
**Post date:** [May 5, 2021, 1:41pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/7 "2021-05-05T13:41:11Z")

</div>

Still no solution?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 5, 2021, 1:43pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/8 "2021-05-05T13:43:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 13, 2021, 2:10pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/9 "2021-05-13T14:10:06Z")

</div>

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 ☹

```auto
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

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 13, 2021, 2:14pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/10 "2021-05-13T14:14:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 13, 2021, 2:15pm UTC](https://forum.inductiveautomation.com/t/monitoring-the-device-load-factor/17389/11 "2021-05-13T14:15:28Z")

</div>

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