<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Traceroute]]></title><description><![CDATA[<p dir="auto">hi all,</p>
<p dir="auto">I just wonder if there is any monitor on the trace route result! What I want to do is if the predefined traceroute result is different from the real time traceroute result, an alert should be sent out.</p>
<p dir="auto">Thanks!</p>
<p dir="auto">Pedro</p>
]]></description><link>https://forum.netxms.org/topic/3167/traceroute</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 14:42:15 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/3167.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 May 2014 07:00:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Traceroute on Thu, 29 May 2014 07:53:24 GMT]]></title><description><![CDATA[<p dir="auto">hi All, after digging on the forum, I finally figured out how to do that. Basically, I use ExternalParameter to implement the traceroute checking function.  Here is what I did :-</p>
<ol>
<li>
<p dir="auto">Create a powershell script in a host, check_3hoptracert.ps1</p>
</li>
<li>
<p dir="auto">In the nxagentd.conf, add this line</p>
</li>
</ol>
<p dir="auto">ExternalParameter = Check_3Hop(*): "c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "D:\netxms-agent\bin\check_3hoptracert.ps1" $1 $2 $3 $4</p>
<ol start="3">
<li>In NetXMS console, add a DCI per the screen attached.</li>
</ol>
<p dir="auto">Please make sure the AgentCommandTimeout specified in server configuration and exectimeout specified in nxagentd.conf are large enough to execute the script.</p>
<p dir="auto">I hope this can help someone in the future. Thanks!</p>
<p dir="auto">check_3hoptracert.ps1<br />
===============<br />
# This script is to check whether the first 3 hops of a traceroute is the same as the specifed ip addresses<br />
# Return "OK" if same; otherwise "Changed"<br />
#<br />
# Usage : check_3hoptracert hostname 1st-hop 2nd-hop 3rd-hop<br />
#<br />
# Written by Pedro on 29/5/2014</p>
<p dir="auto"># Get arguments<br />
$hostname = $args[0]<br />
$ip1 = $args[1]<br />
$ip2 = $args[2]<br />
$ip3 = $args[3]</p>
<p dir="auto"># Run traceroute<br />
tracert -d $hostname &gt; c:\temp\tracert.txt</p>
<p dir="auto"># Get 1st hop<br />
$hop1 = get-content c:\temp\tracert.txt | select-object -skip 3 | select-object -First 1 | % { $_.substring(32,9); }<br />
#write-host $hop1  " " $ip1<br />
if ( $hop1 -ne $ip1 ) {  write-host "Changed"; EXIT 0; }</p>
<p dir="auto"># Get 2nd hop<br />
$hop2 = get-content c:\temp\tracert.txt | select-object -skip 4 | select-object -First 1 | % { $_.substring(32,9); }<br />
#write-host $hop2<br />
if ( $hop2 -ne $ip2 ) {  write-host "Changed"; EXIT 0; }</p>
<p dir="auto"># Get 3rd hop<br />
$hop3 = get-content c:\temp\tracert.txt | select-object -skip 5 | select-object -First 1 | % { $_.substring(32,9); }<br />
#write-host $hop3<br />
if ( $hop3 -ne $ip3 ) {  write-host "Changed"; EXIT 0; }</p>
<p dir="auto"># The traceroute result is the same as specified<br />
write-host "OK"<br />
del c:\temp\tracert.txt<br />
EXIT 1</p>
<hr />
<p dir="auto"><img src="/assets/uploads/files/smf/0000000001761-dci.jpg" alt="dci.jpg" class="img-markdown  img-fluid" width="719" height="707" /></p>
]]></description><link>https://forum.netxms.org/post/14011</link><guid isPermaLink="true">https://forum.netxms.org/post/14011</guid><dc:creator><![CDATA[pedrong]]></dc:creator><pubDate>Thu, 29 May 2014 07:53:24 GMT</pubDate></item></channel></rss>