# How to implement it as a perspective ( Ignition-\> Status -\> Performance -\> Overview )

**URL:** <https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [May 9, 2023, 2:25am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445 "2023-05-09T02:25:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [May 9, 2023, 2:25am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/1 "2023-05-09T02:25:33Z")

</div>

Hi ~

As in the attached file.

I want to implement a screen with cpu, memory, threads, cpu trend, memory trend, etc. in Performance on the web as it is from a perspective, what should I do?

 ![1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/b/4b3c9d3efca7283065c1d9fba427d81d5be751f3.gif)

---

<div class="post-metadata">

**Author:** ![andrew.budaiev](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andrew.budaiev/32/72921_2.png) [@andrew.budaiev](https://forum.inductiveautomation.com/u/andrew.budaiev)\
**Post date:** [May 9, 2023, 3:24am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/2 "2023-05-09T03:24:00Z")

</div>

[https://docs.inductiveautomation.com/display/DOC81/System+Tags](https://docs.inductiveautomation.com/display/DOC81/System+Tags)

---

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [May 9, 2023, 6:50am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/4 "2023-05-09T06:50:00Z")

</div>

![4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/9/b9e908786f15020b16292ef9117417f2fd0b3aa0.gif)

Is it possible to express the data in threads from the perspective as shown in the attached file?

---

<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 9, 2023, 10:42am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/5 "2023-05-09T10:42:30Z")

</div>

I know how to get the counts of the categories (timed waiting, running, blocked,.. One other one) of threads? Or do you want the details of the threads as in your screenshot?

---

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [May 10, 2023, 12:03am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/7 "2023-05-10T00:03:42Z")

</div>

Could you tell me both ways you said?

---

<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 10, 2023, 2:39am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/8 "2023-05-10T02:39:44Z")

</div>

```auto
def _getGatewayMetrics():
	fn = 'getGatewayMetrics'
	from com.inductiveautomation.ignition.gateway import IgnitionGateway
	
	try:
		context = IgnitionGateway.get()
		registry = context.getMetricRegistry()
		metrics = {}
		
		items = registry.getCounters()
		for item in items:
			#LOGGER.info('{}: {}'.format(fn, ', '.join(d for d in dir(item))))
			o = items.get(item)
			metrics[item] = {'type': 'counter',
							 'value': o.getCount()
							}
		
		items = registry.getMeters()
		for item in items:
			o = items.get(item)
			metrics[item] = {'type': 'meter',
							 'value_1min': o.getOneMinuteRate(),
							 'value_5min': o.getFiveMinuteRate(),
							 'value_15min': o.getFifteenMinuteRate()
							}
		
		items = registry.getGauges()
		for item in items:
			o = items.get(item)
			metrics[item] = {'type': 'gauge',
							 'value': o.getValue()
							}
	
	#	for item in registry.getHistograms():
		
		items = registry.getTimers()
		for item in items:
			o = items.get(item)
			metrics[item] = {'type': 'timer',
							 'value_1min': o.getOneMinuteRate(),
							 'value_5min': o.getFiveMinuteRate(),
							 'value_15min': o.getFifteenMinuteRate()
							}
	except:
		import traceback
		LOGGER.error('{}: {}'.format(fn, traceback.format_exc()))
		return {}
	
	return metrics

def writeMetricsTags():
	fn = 'writeMetricsTags'
	try:
		metrics = _getGatewayMetrics()
		
		if metrics != {}:
			tags = []
			# updated the metrics keys after upgrading from 8.1.5 to 8.1.18 as these changed
			tags.append(['[default]Gateway/Threads/Blocked', metrics['ignition.performance.threads.blocked']['value']])
			tags.append(['[default]Gateway/Threads/Running', metrics['ignition.performance.threads.running']['value']])
			tags.append(['[default]Gateway/Threads/Timed_Waiting', metrics['ignition.performance.threads.timed-waiting']['value']])
			tags.append(['[default]Gateway/Threads/Waiting', metrics['ignition.performance.threads.waiting']['value']])
			
			tags.append(['[default]Gateway/GAN/Incoming Connections (1min Avg)', metrics['GANConnection.Incoming._0:0:{your ignition gateway system name}']['value_1min']])
			tags.append(['[default]Gateway/GAN/Outgoing Connections (1min Avg)', metrics['GANConnection.Outgoing._0:0:{your ignition gateway system name}']['value_1min']])
			
			# this metric appears to have been removed in > 8.1.5
			#tags.append(['[default]Gateway/GAN/Activity Level', metrics['i:GAN_Activity_Info_Service/getActivityLevel']['value_1min']])
			
			system.tag.writeBlocking([tag for tag,val in tags], [val for tag,val in tags])
	except:
		# do some error logging
		pass

```

You can get the gateway metrics which include the categorised thread counts using the above functions. `writeMetricsTags` will write various metrics into tags. You'll need to add these tags for it to be able to write into them.  
Edit:  
Note: you'll need to run this in the gateway scope

---

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [May 10, 2023, 5:06am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/10 "2023-05-10T05:06:41Z")

</div>

Thanks for letting me know.

But I don't know how to use the method you told me.

Should I use the method you taught me in gateway events?

Or should I use it for the project library?

And I told you to make a tag, but how do I make a tag?

I don't know how to use it because it's my first time using it...

Can you tell me the details?

---

<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 10, 2023, 5:22am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/11 "2023-05-10T05:22:38Z")

</div>

Firstly, it needs to be run in the gateway context.  
I would suggest you run the script within a gateway scheduled event script which runs every x seconds. (I added the script into a function in a script library and then called the library function from the GW scheduled event).

> [@jiyoung\_hwang1](#):
>
> but how do I make a tag?

The tagpaths you need to create are contained in the script. These should be integer memory tags (apart from maybe the 1min averaged values) i.e.

```auto
tags.append(['[default]Gateway/Threads/Blocked', metrics['ignition.performance.threads.blocked']['value']])
tags.append(['[default]Gateway/Threads/Running', metrics['ignition.performance.threads.running']['value']])
tags.append(['[default]Gateway/Threads/Timed_Waiting', metrics['ignition.performance.threads.timed-waiting']['value']])
tags.append(['[default]Gateway/Threads/Waiting', metrics['ignition.performance.threads.waiting']['value']])
			
tags.append(['[default]Gateway/GAN/Incoming Connections (1min Avg)', metrics['GANConnection.Incoming._0:0:{your ignition gateway system name}']['value_1min']])
tags.append(['[default]Gateway/GAN/Outgoing Connections (1min Avg)', metrics['GANConnection.Outgoing._0:0:{your ignition gateway system name}']['value_1min']])

```

---

<div class="post-metadata">

**Author:** ![jiyoung\_hwang1](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jiyoung\_hwang1](https://forum.inductiveautomation.com/u/jiyoung_hwang1)\
**Post date:** [May 10, 2023, 7:34am UTC](https://forum.inductiveautomation.com/t/how-to-implement-it-as-a-perspective-ignition-status-performance-overview/73445/12 "2023-05-10T07:34:34Z")

</div>

ㅇ
