# Traceroute from Ignition

**URL:** <https://forum.inductiveautomation.com/t/traceroute-from-ignition/17822>\
**Category:** General Discussion\
**Created:** [April 24, 2018, 8:20pm UTC](https://forum.inductiveautomation.com/t/traceroute-from-ignition/17822 "2018-04-24T20:20:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbturner](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@jbturner](https://forum.inductiveautomation.com/u/jbturner)\
**Post date:** [April 24, 2018, 8:20pm UTC](https://forum.inductiveautomation.com/t/traceroute-from-ignition/17822/1 "2018-04-24T20:20:55Z")

</div>

Does anyone have any experience getting traceroute information into ignition? Basically, I’m trying to monitor the hops to see if a primary tunnel goes down. Ultimately, I’d be looking to determine is if an I.P. address is found in the hops. If so, write to a Boolean tag. Some searching seems to indicate that this may be accomplished with Python but my experience in python isn’t as vast as the examples I’ve found would require. Does anyone have any thoughts or suggestions? Perhaps even a totally different approach.

---

<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:** [April 24, 2018, 9:38pm UTC](https://forum.inductiveautomation.com/t/traceroute-from-ignition/17822/2 "2018-04-24T21:38:49Z")

</div>

You’d have to package a module or manually install a [suitable java library](http://icmp4j.org/d/index.html). The ICMP packet subtype is is not exposed by Java’s native networking, and is therefore unavailable to jython, too.

---

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [May 5, 2018, 10:50pm UTC](https://forum.inductiveautomation.com/t/traceroute-from-ignition/17822/3 "2018-05-05T22:50:30Z")

</div>

You can do it out of the OS shell this how I do it in windows.

def Tracert(Addr,Debug=0,Wait=1000,MaxHops=30):  
“”“Created:12/16/17 By:Gerry Huck LastRev: By: Ver=1.0  
Returns route in one str. Best practice to run in it’s own thread.”""  
import os  
WaitStr = "-w “+str(Wait)+” "  
MaxHops = "-h “+str(MaxHops)+” "  
DOS = "tracert "+WaitStr+MaxHops+str(Addr)  
Ret = os.popen(DOS).read()  
if Debug:  
print DOS  
print Ret  
return Ret

RouteData = Tracert(“10.31.43.28”,Debug=1,Wait=50,MaxHops=2)  
print RouteData

Lines = RouteData.splitlines()  
print Lines[1]

---

<div class="post-metadata">

**Author:** ![ghuck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ghuck/32/8337_2.png) [@ghuck](https://forum.inductiveautomation.com/u/ghuck)\
**Post date:** [May 5, 2018, 11:02pm UTC](https://forum.inductiveautomation.com/t/traceroute-from-ignition/17822/4 "2018-05-05T23:02:20Z")

</div>

Sorry last post did not keep the indents.

```auto
def Tracert(Addr,Debug=0,Wait=1000,MaxHops=30):
	"""Created:12/16/17 By:Gerry Huck LastRev: By: Ver=1.0
	Returns route in one str. Best practice to run in it's own thread."""
	import os
	WaitStr = "-w "+str(Wait)+" "
	MaxHops = "-h "+str(MaxHops)+" "
	DOS = "tracert "+WaitStr+MaxHops+str(Addr)
	Ret = os.popen(DOS).read()
	if Debug: 
		print DOS
		print Ret
	return Ret
	
RouteData = Tracert("10.31.43.28",Debug=1,Wait=50,MaxHops=2)
print RouteData

Lines = RouteData.splitlines()
print Lines[1]

```
