# Get active gateway node name?

**URL:** <https://forum.inductiveautomation.com/t/get-active-gateway-node-name/5877>\
**Category:** Ignition\
**Created:** [February 15, 2013, 3:56pm UTC](https://forum.inductiveautomation.com/t/get-active-gateway-node-name/5877 "2013-02-15T15:56:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eaolson](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@eaolson](https://forum.inductiveautomation.com/u/eaolson)\
**Post date:** [February 15, 2013, 3:56pm UTC](https://forum.inductiveautomation.com/t/get-active-gateway-node-name/5877/1 "2013-02-15T15:56:47Z")

</div>

We have a redundant setup and I’m wondering if there’s any way for a transaction group to see which node is the master node. I’m looking through the Server section of the Ignition OPC server tags and I don’t see anything.

I’m putting together a meta-project to report on the state of our projects, and I thought it would be good to include which node is currently the master.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [February 15, 2013, 8:58pm UTC](https://forum.inductiveautomation.com/t/get-active-gateway-node-name/5877/2 "2013-02-15T20:58:33Z")

</div>

You can use the role system tag:

[System]Gateway/Redundancy/Role

It will show whether or not the connected server is master or backup. You could always make an expression tag that looked at the tag and returned your own name.

---

<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:** [February 15, 2013, 8:59pm UTC](https://forum.inductiveautomation.com/t/get-active-gateway-node-name/5877/3 "2013-02-15T20:59:17Z")

</div>

I thought some of the newer versions had this built in?

if not this will work

```auto
from java.net import InetAddress
nodename = InetAddress.getLocalHost().getHostName() 
system.tag.writeToTag('NodeName', nodename)
```

where NodeName is a tag

---

<div class="post-metadata">

**Author:** ![eaolson](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@eaolson](https://forum.inductiveautomation.com/u/eaolson)\
**Post date:** [February 19, 2013, 3:45pm UTC](https://forum.inductiveautomation.com/t/get-active-gateway-node-name/5877/4 "2013-02-19T15:45:06Z")

</div>

[quote=“diat150”]`
from java.net import InetAddress
nodename = InetAddress.getLocalHost().getHostName() 
system.tag.writeToTag('NodeName', nodename)
`  
[/quote]

That pretty much did it. Put that into a function in a script module that returns the host name. That can even be used in an expression tag in a transaction group, using runScript().

Also, I think, runScript(“system.util.getGatewayAddress()”) in an expression tag would work.
