clint,
I understand your concern for wanting to have something that "just works" no matter where you install it. I assume this means you are already aware of the various traceroute and diff modules. Unfortunately, you have assumed that library dependencies are the only thing you need to be concerned about. Are all the machines running the exact same OS with the exact same version of Perl with the exact same port of traceroute and diff? Regardless of the answer, it would helpful to see a sample output.
I can show you code of how I would do it on my work machine which would likely differ a bit on how I would do it at home and neither may work for you.
| [reply] |
Hi Limbic~Region,
many thanx for your answer. I understand what you mean. But my main problem is how to interpret the diff output, how do I count the route differences. This code should run mainly on OpenBSD and Linux. Traceroute and diff operates the same way on these OSs according to my tests.
Many thanx in advance.
Clint
| [reply] |
clint,
As merlyn was keen to point out, more details are required. The single most important piece of my response was "it would helpful to see a sample output". That isn't just the traceroute output, but also what you want to do with it. I am more of a visual person and want to "see" what you want to accomplish while merlyn is more of an auditory person and wants you to describe the process. Either way - we need more information.
| [reply] |
You'll probably need to be more specific. Traceroute generally has 3 probes per hopcount. How do you want to show the differences? Between the smallest of one set to the largest of the other?
And what if the route flaps in the middle (where you get a new host on a given line)? How do you want to see that?
And what if the route is different from one view to the next? The hop-by-hop counts will be relatively unrelated after the first branch point.
So, if you can explain (as in provide a specification) what you mean by "count the route differences", you might get a more concrete answer rather than all the handwaving responses so far.
| [reply] |
When I wrote something like this, it ended up being very complex. I am a network guy, so you'll need to bear with me for a minute. There are protocols that allow a set of routers to act like one router (VRRP, HSRP). Cisco's HSRP happens to like flip-flopping, so traceroute likes to reports both addresses/routers on the same line. Names can change too easily, so I didn't do any processing with names, just on the IP addresses. But, when I got two addresses on a single line, I created a group and later considered any address within that group to be equivalent.
In my scheme, your example has one difference, the additional route toward the bottom. I don't remember the difference logic very well, but it was convoluted.
Well, months went by, I finally went in and did some sanity checking with the groups, and there were some major problems. It ended up having a very large group of like 30 addresses it considered equivalent. Unfortunately that made lots of the "hops" within a traceroute equivalent. ie a traceroute might end up looking like this after processing: hop1, hop2, group12, group12, group12, hop6, destination. Where those three group 12's in the middle were representative of different routers that had been grouped together as being equivalent by my code. I'll try to dig that code up after lunch and either post some of it, or at least give you a better feel for the difference logic I'd used.
Update: Seems my difference code was very simplistic, aside from the "group" checking. Go through each traceroute in lockstep, and if they're different, add one to the difference count. I'd had a comment to improve that to make it more "diff-like", but I never got there, sorry.
-Scott | [reply] |
What about running traceroute in backticks?
I have a very basic backup-script you could look at to show you how to run the system command and log the output.
You can then process the saved file anyway you wish.
Bear in mind that it's very basic.
HTH.
Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!
| [reply] |