Traceroute from Ignition

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.

You’d have to package a module or manually install a suitable java library. The ICMP packet subtype is is not exposed by Java’s native networking, and is therefore unavailable to jython, too.

1 Like

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]

Sorry last post did not keep the indents.

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]