Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Fellow Monks,
  &nsbp I am sure that there is a better way to do what I am trying to do. I am writing a script that allows people to input an IP from our call center and do simple tests. Forward and Reverse NS Lookup, Ping, and the killer, Traceroute. Pretty simple stuff, but the traceroute is killing me. I am on sunOS 5.7, and the traceroute binary I have running does not seem to have a way to die. Basically, if someone puts in a bad a ip, ie 1.2.3.4 it will get to the gateway and just hang. Currently I work around this by
$fork = fork(); if(fork){ sleep 20; open (MYFILE, "traceroute$time.txt"); @data = <MYFILE>; if (!@data){ $error = 'Ip could not be Tracerouted'; push (@lines, $error); }else{ foreach $line (@data) { $line =~ s/\n/<br>/g; push (@lines, $line); } } }else{ $tracert = `traceroute "$ip" > traceroute$time.txt`; }
A simple, yet archaic answer to an issue that I know can be solved more easily. I was thinking about just using a system() call, sleeping, then checking it to see if I got results, but that would really not speed things up much. Please help me to find a better way!

Tradez
"Never underestimate the predicability of stupidity"
- Bullet Tooth Tony, Snatch (2001)

In reply to A better way to test network elements by tradez

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 16:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found