Identify your network's critical paths with this member-submitted script
Takeaway: TechRepublic asked members to submit their favorite network administration scripts and this is one of the responses. You can use this script to identify the critical paths of your network.
By Tom Loveday
TechRepublic recently asked members to submit their favorite Network Administration scripts for possible publication. One of the first to make a submission was Tom Loveday. For his effort, Tom earned $100 and the satisfaction of seeing his script published on TechRepublic.
Earn $100 for your admin script
Let us pay you for your original scripts so that we can publish them as downloads on TechRepublic and allow your fellow IT professionals to benefit from your scripting savvy. We only ask that you put in the appropriate comments to your scripts so that it's easy to tell what the script is doing and which variables might need to be customized. Send us your original admin scripts and we'll pay you $100 for each one that we publish as a TechRepublic download.
Editor's note: These scripts are included in the downloadable Zip file for your convenience.
What it does
This is a very simple script but it saves me a lot of headaches. I run a somewhat complex small network that traverses a university campus and includes a lot of the elements that the big boys use and also has an additional caveat. I do not have permissions to manage many of my own network devices. That means I do not have admin access to any of my own managed switches or routers. (I do have physical access) The campus does that. To get around this limitation, I wrote the following script (Listing A) that runs every morning a few minutes after I sit down at my desk and pops up at me.
By looking at my network diagram that I drew when I first started working here (the first document of its kind here) I identified the critical paths of our network. At the far end of each of those paths, I have identified a device that will respond to a ping. In most cases that is a printer; sometimes it is a server.
By looking at what pings and what does not, I can isolate to a single switch/router for every path except for one where there are two CSU/DSUs and a router that cannot be distinguished from each other.
This is really a quick and dirty script and not really sophisticated but it does work. It requires Perl and a good knowledge of your network architecture to implement.
I could have put all the IPs in an array and looped but since this is a trouble shooting tool, it is easier to figure out the problem if the script is linear. Enjoy!
Listing A
use Net::Ping;use LWP::Simple;
use Tk;
use Tk::DialogBox;
# initialize all the switch status' to "down"
$annex = "down";
$nfsprc = "down";
$hcrl = "down";
$smfr = "down";
$orst = "down";
$goog = "down";
$hops = "down";
$helpd = "down";
$ncgr = "down";
# ping each of the nodes to see which paths work
$host = "128.193.230.202"; # check the switch and server in this building
if (pingecho($host))
{
$annex = "up"; #annex switch works, server responds
}
$host = "111.222.333.444";
if (pingecho($host))
{
$helpd = "up"; # help desk server is up
}
$host = "111.222.333.444"; # check the server in the next building over
if (pingecho($host))
{
$hcrl = "up"; # switch in that building is up
$nfsprc = "up"; # fibre and switch in main telecom room is up
}
$host = "111.222.333.444"; # check printer in admin building
if (pingecho($host))
{
$smfr = "up"; #switch and printer are up
}
$host = "mail.oregonstate.edu"; #checking the ciscos now
if (pingecho($host))
{
$orst = "up"; # router to campus is up
}
$host = "111.222.333.444";
if (pingecho($host))
{
$ncgr = "up"; # T1 connection to Farm is up
}
$host = "willamette.net"; #checking the internet
if (pingecho($host))
{
$goog = "up"; # internet is available
}
$msg1 = sprintf("Annex Switch is %s\n",$annex);
$msg2 = sprintf("Library Switch is %s\n",$hcrl);
$msg3 = sprintf("Conference Switch is %s\n",$smfr);
$msg4 = sprintf("NFSPRC Switch is %s\n",$nfsprc);
$msg5 = sprintf("cisco router is %s\n",$orst);
$msg6 = sprintf("internet is %s\n",$goog);
$msg8 = sprintf("Helpdesk server is %s\n",$helpd);
$msg9 = sprintf("NCGR T1 is %s\n",$goog);
$msg10 = "the closest item that is down is the trouble spot\n";
$msg = $msg1 . $msg2 . $msg3 . $msg4 . $msg5 . $msg6 . $msg8 . $msg9;
my $mw = MainWindow->new;
$mw->Button(-text => $msg, -command =>sub{exit})->pack;
MainLoop;
Print/View all Posts Comments on this article
SponsoredWhite Papers, Webcasts, and Downloads
- Sales 2.0: How Businesses are Using Online Collaboration to Spark Sales Oracle
- How Business Networks are Evolving Today SAP
- IP Telephony from A to Z: The Complete IP Telephony eBook ShoreTel
- Choosing a Reliable and Powerful IT Infrastructure at a Price You Can Afford Oracle
- Keeping Pace with Expansion through Voice Services ShoreTel
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET
