# Is there a system tag that shows the OPC connection status?

**URL:** <https://forum.inductiveautomation.com/t/is-there-a-system-tag-that-shows-the-opc-connection-status/7849>\
**Category:** Ignition\
**Created:** [January 16, 2014, 2:32pm UTC](https://forum.inductiveautomation.com/t/is-there-a-system-tag-that-shows-the-opc-connection-status/7849 "2014-01-16T14:32:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [January 16, 2014, 2:32pm UTC](https://forum.inductiveautomation.com/t/is-there-a-system-tag-that-shows-the-opc-connection-status/7849/1 "2014-01-16T14:32:58Z")

</div>

Is there a system tag that shows the OPC connection status? I found the function

```auto
system.opc.getServerState(opcServer)
```

Currently, here is how I’m doing it with an expression tag

`
switch(
	runScript("system.opc.getServerState('OPCConnection')", 5000), // value
		'FAULTED', // case 1
		1, // return 1
		0 // default
) `

but i wanted to monitor a tag, not have a script where i convert text to an int. I looked through the system tags but i didn’t see anything that caught my eye.

Thanks!

---

<div class="post-metadata">

**Author:** ![d.laquidain](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@d.laquidain](https://forum.inductiveautomation.com/u/d.laquidain)\
**Post date:** [January 16, 2014, 4:36pm UTC](https://forum.inductiveautomation.com/t/is-there-a-system-tag-that-shows-the-opc-connection-status/7849/2 "2014-01-16T16:36:24Z")

</div>

Hi,

there isn´t tags to monitor it. You can use an expression tag and write the following code:

if((runScript(“system.opc.getServerState(‘Matrikon UCS’)”,5000)) = “CONNECTED”,  
“1”,  
“0”)

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [January 16, 2014, 5:39pm UTC](https://forum.inductiveautomation.com/t/is-there-a-system-tag-that-shows-the-opc-connection-status/7849/3 "2014-01-16T17:39:51Z")

</div>

Thanks, i guess we did the same thing just in different ways.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [January 16, 2014, 6:28pm UTC](https://forum.inductiveautomation.com/t/is-there-a-system-tag-that-shows-the-opc-connection-status/7849/4 "2014-01-16T18:28:22Z")

</div>

most opc servers have system tags that should always have good quality as long as the connection is up. checking quality on these is another way you could verify a good connection.

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [January 16, 2014, 9:17pm UTC](https://forum.inductiveautomation.com/t/is-there-a-system-tag-that-shows-the-opc-connection-status/7849/5 "2014-01-16T21:17:33Z")

</div>

Thanks, I am checking the system tag in Kepware to verify that the connection to the PLC is up. But if the connection is down to kepware i wont get any tags.

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [May 1, 2014, 11:59pm UTC](https://forum.inductiveautomation.com/t/is-there-a-system-tag-that-shows-the-opc-connection-status/7849/6 "2014-05-01T23:59:34Z")

</div>

You could use the Sever/ServerStatus/State tag
