Vision\Perspective Window & Tag Counts

I have a task to develop some basic metrics around the systems we support. A couple of these that came up were tag counts and number of windows. We support an enterprise system setup in a hub and spoke architecture, so something that can be aggregated easily would be ideal (wanting to avoid logging into each gateway for some of these metrics, if that makes sense).

I see in the OPC browser that I can get metadata on the devices, including tag counts (ItemCounts), which would explain the number of actual tags being scanned (maybe an interesting KPI), but I’m not seeing anything that easily shows me the total number of OPC tags in the provider(s). On the Gateway Status page, the total tags are displayed there. I guess what I’m not sure is if the total tags on the status page are the sum of all device tags, or if those are all the OPC tags, and if so, is there an easy way to capture that somehow?

As for all OPC tags (which is what I’m after) I can create a script like

len(system.tag.browseTagsSimple("","ASC"))

but it feels like there might be an easier way. Also, this requires I also include all providers, and I’m not sure how I would do this from a gateway scoped call (I’m not sure what scripting functions exist to find providers dynamically) that would automatically update regardless of number of tag providers.

On the window side of things, I can also see a path for using something like

len(system.gui.getWindowNames())

but this would need to be setup per project, from what I can tell. Anyone have thoughts on best approach?

We too are looking for the same metric and performing a similar exercise to pull out information for some KPI dashboarding. Did you ever find a solution? Bumping this thread to see if anyone else has ideas. It shows on the gateway web page so guessing it isn’t impossible to pull out in some light fashion. Maybe pull from the internal tag database?

Welcome Craig!

I dug a little deeper when I was working on it, but something higher priority tore me away from finishing this up. I liked the gateway status screens showing all the information, but it didn’t cover all data that I was after. I can say that using the len(system.tag.browseTagsSimple() function worked ok to get all tags (Memory, OPC, etc…), but on larger systems, performance is not ideal. I tried on one of our development systems with 50k tags, and it took several seconds to complete (30-60 from what I recall). If you go this route, I suggest you only run it on demand or schedule it to run a some predetermined time.

I will say, however, that metrics on devices and the tags being requested is readily available, and if that’s all you’re looking for, is quite easy to gather.

I do remember thinking I read somewhere that IA was planning to expand the data available from the System Provider with more of the metrics shown on the Gateway Status pages. I’m not finding it though. Maybe @Kevin.Herron or one of the other IA folks can chime in.

By the way, if you aren’t aware, IA has a Features and Ideas website if you think something new needs added (https://inductiveautomation.canny.io/)

Appreciate the insight. Our system has grown over the last 4 years and reports 2.2M MQTT tags in the gateway webpage under the MQTT Engine provider so we are definitely not wanting to try and run a recursive browse/count. More just trying to get at that same info if it was readily available. I will keep digging and may add as a feature request at some point with them or Cirrus Link since in our case is on that end. Thanks!

I’m only just seeing this now, I realise your OP was a year ago… but for the metrics on counting Windows and Views (and any* other resources), I would actually do this at the directory level. You can get the path to the data directory with this:

# this will only work in the gateway scope
from com.inductiveautomation.ignition.gateway import IgnitionGateway
context = IgnitionGateway.get()
projectParentFolder = str(context.systemManager.dataDir.absoluteFile).replace('\\','/') + '/projects'

E.g.
C:/Program Files/Inductive Automation/Ignition/data
(replace \ with / to avoid the hassle of having to escape the \)

From there, you can walk through your project directories and pull out all of your project’s resources and summarise them.

*any = any resources stored as files

Just to be clear, this is essentially looking at the files on the install path, correct? If so, this would imply Ignition 8+ since it stores the project resources as files as opposed to the internal DB, right?

I think this is a quick and easy hack that I hadn’t thought about. I guess we need to move to 8 sooner rather than later.

Yep and

Yep

You wouldn’t be able to do this in v7