Helping to solve the age-old problem "The network is slow"During my time as a network administrator, I cannot tell you how often someone has told me “the network is slow.” Since the network is the big magic box, traffic is injected at one end and mysteriously appears at the other. If there is ever a performance issue with an application or service, the network is to blame. As a network administrator, you are now obligated to prove or disprove the performance of the infrastructure. Anyone that has been unfortunate enough to find themselves in this situation, understands what a painstaking process it is to capture, correlate, analyze, scrutinize, and justify your findings. What if you could direct them to a site that had real-time network/application performance statistics? Using Embedded Event Manager (EEM) and Tcl (Tool Command Language) you have the capability to create a Web page that can display the current statistical information gathered from IP Service Level Agreement (IPSLA) on how a specific application is behaving. This may not alleviate all the troubleshooting situations, but it can certainly be a good start. Let’s consider the following situation, where a user at a remote location is experiencing application slowness. In this example, the client is accessing a TFTP server at the central data center and is noticing slow performance. Although we are using a TFTP application, this could be any application or service running on your network. The following network diagram will be used:
We begin by configuring the “IP-SLA Responder” router as follows from configuration mode: Configure the IP-SLA responder: In order to provide adequate Quality of Server (QoS) for this application, we’ll create a policy and apply it to the serial interface. This policy is very rudimentary and used as an example only: Next, we’ll configuring the “IP-SLA Sender” router as follows from configuration mode: Configure the IP-SLA sender to match the traffic type of the application. Using a udp-echo on port 69, directed to the loopback address of the “IP-SLA Responder” router will simulate application traffic: ip sla 10 Create a QoS policy and apply it to the outgoing interface: We’ll use the following script to collect IP-SLA information every 60 seconds and store that information to a file on the router. Using CRON, the script will run every 1 minute. Prepare to collect IP-SLA information from the router. Collect the sla statistics and store it in the result in the variable “RTT”. If the string length is less than 10 characters, it's not a valid sample. If the END value is less than 0 it indicates that the time is unknown, in this case, set the value to 0. Locate the time of the last sample. If the END value is less than 0 it indicates that the time is unknown, in this case, set the value to 0. Format the string with name and value. If the file doesn't exist, create it. Write the data to a variable called TEMP_Data. Delete the file. Open the file for writing With 4 elements per line we are only interested in seeing 1 hours worth of information, or 240 elements. Store the information to the file and close it. The information has been collected and stored to a file on the router. We now need to create another script that will allow a user to easily view the information. To leverage some of the previous work, we’ll use the web server script from the book “Tcl Scripting in Cisco IOS” as the foundation, but we’ll have to write some code to display the information that we are interested in seeing: Open the Data.xml file for reading and store the information in a variable called “TEMP_Data”. In order to display the information correctly, we must add several parameters to the beginning and end of the file. Delete the old file. Open the file and write the information. Create the HTML section. The section below uses the file “Graph.xml” to display the line chart. set httpheader "HTTP/1.1 200 OK Display the information. Prepare the router to run the Tcl scripts. Create a directory on a local storage device, in this case, we are using the local flash. Copy the Tcl files and the FCF_Line.swf file to the directory. Copy the files using your preferred method. The results should be as follows: IPSLA-Sender#dir flash:/TCL 30 -rw- 1522 Jun 22 2010 22:12:08 -07:00 IPSLA_Viewer.tcl Using configuration mode, add the following commands to the IPSLA-Sender router: Specify the location of the scripts: The next line is critical to allow multiple scripts to run simultaneously. The IPSLA_Collector.tcl script will run using CRON, but we will manually start the Web_Server script as follows: (Note: This is not entered in configuration mode.) The client can now view the IP-SLA information by accessing the following link: http://172.17.2.1:8082/TCL/IPSLA_Viewer.tcl and should see a similar display:
• Note: The Web_Server.tcl script was modified to use port 8082. Below are some helpful troubleshooting commands: IPSLA-Sender#show event manager policy registered 2 script user timer cron Off Tue Jun 22 22:56:18 2010 IPSLA_Collector.tcl IPSLA-Sender#show ip sla statistics 10 IPSLA operation id: 10 IPSLA-Sender#show policy-map interface s0/0/0 Service-policy output: POL-MAP Class-map: APP (match-any) Class-map: class-default (match-any) queue limit 64 packets Any user has the capability to access a web page on a router to determine the current status of an application at a particular location. The remote router (IP-SLA Sender) is configured to send UDP probes using IP-SLA. The script IPSLA_Collector.tcl runs every 60 seconds and gathers critical information from the “show ip sla statistics 10” command and stores that information in a local file. The “Web_Server.tcl” script acts as a web server for the router. The IPSLA_Viewer.tcl script reads the collected information from the Data.xml file created from the IPSLA_Collector.tcl script, reformats the data, saves it as Graph.xml, and displays the information using the FusionCharts (http://www.fusioncharts.com/) charting software. The responsibility of the IP-SLA Responder router is simply to respond back to requests from the sender. This example gives you the basics of how to provide information to the general population on what is happening on the network, including specific application behavior. You have the capability to gather statistical information from IP-SLA or any other method of your choosing, store it and save it for future viewing. Although this may not completely eliminate the questions regarding the slowness of the network, it is a great start. About the Author:
|
||||



