<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>108.bz &#187; Performance Monitoring</title>
	<atom:link href="http://www.108.bz/posts/tag/performance-monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.108.bz</link>
	<description>Wandering futilities...</description>
	<lastBuildDate>Fri, 27 May 2011 09:08:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Allot NetEnforcer bandwidth reports</title>
		<link>http://www.108.bz/posts/it/allot-netenforcer-bandwidth-reports/</link>
		<comments>http://www.108.bz/posts/it/allot-netenforcer-bandwidth-reports/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 14:01:20 +0000</pubDate>
		<dc:creator>Giuliano</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Allot]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Performance Monitoring]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://www.108.bz/?p=429</guid>
		<description><![CDATA[A while ago I was trying to get my head around some nasty network performance issues. A couple of firewalls were in the play, along with a Bandwidth Manager device (an Allot NetEnforcer AC-402). I wasn&#8217;t completely satisfied with NetEnforcer reporting functions and wanted something more dependable and realtime. Well, if you turn to the [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I was trying to get my head around some nasty network performance issues. A couple of firewalls were in the play, along with a Bandwidth Manager device (an <a href="http://www.allot.com/NetEnforcer_AC-400.html">Allot NetEnforcer AC-402</a>).</p>
<p>I wasn&#8217;t completely satisfied with NetEnforcer reporting functions and wanted something more dependable and realtime. Well, if you turn to the device&#8217;s CLI access (SSH), you&#8217;ll notice an interesting <span style="font-family: Bitstream Vera Sans Mono,Courier New,monospace;">acthruput</span> command.<br />
It shows the <i>current</i> throughput per Interface, Line, Pipe and Virtual Channel. What more could you ask for?</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">AC:~# acthruput<br />
---------------------------------------------------------<br />
Entity &nbsp; &nbsp; &nbsp; &nbsp; Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bits/sec<br />
---------------------------------------------------------<br />
INTERFACE &nbsp; &nbsp; &nbsp;Internal &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1918600<br />
&nbsp; LINE &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1770720<br />
&nbsp; &nbsp; &nbsp; PIPE &nbsp; &nbsp; 8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2144<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VC &nbsp; 32 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2144<br />
&nbsp; &nbsp; &nbsp; PIPE &nbsp; &nbsp; 5 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7136<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VC &nbsp; 8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7136<br />
[..]<br />
---------------------------------------------------------<br />
INTERFACE &nbsp; &nbsp; &nbsp;External &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9509880<br />
&nbsp; LINE &nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;9421000<br />
&nbsp; &nbsp; &nbsp; PIPE &nbsp; &nbsp; 8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;96960<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VC &nbsp; 32 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 96960<br />
&nbsp; &nbsp; &nbsp; PIPE &nbsp; &nbsp; 13 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 752<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VC &nbsp; 22 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 752<br />
[..]</div></div>
<p>As you can see, <span style="font-family: Bitstream Vera Sans Mono,Courier New,monospace;">acthruput</span> identifies Pipes by number. How do you relate this number to the actual mnemonic pipe name? Use &#8220;<span style="font-family: Bitstream Vera Sans Mono,Courier New,monospace;">acstat -l pipe</span>&#8220;, which also displays the total number of live connections per pipe .</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">AC:~# acstat -l pipe<br />
---------------------------------------------------------------------------------<br />
Rule QID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Rule name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Live connections<br />
---------------------------------------------------------------------------------<br />
1.8.0.0.0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Customer1 ; Fallback &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10<br />
1.13.0.0.0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Customer2 ; Fallback &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7<br />
1.5.0.0.0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Customer3 ; Fallback &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 23<br />
[..]</div></div>
<p>Wrap <span style="font-family: Bitstream Vera Sans Mono,Courier New,monospace;">acthruput</span> in a <i>while</i> loop that adds a timestamp and a delay (&rarr; sampling frequency). Start your terminal emulator logging facilities, hit enter, wait, ctrl-c, stop logging.</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">AC:~# while [ 1 ] ; do date; acthruput; sleep 10; done</div></div>
<p>Eventually, clean the log a bit and feed it to the Perl script you&#8217;ll find at the end of this post.</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ DATE='Thu Dec 10'; grep &quot;$DATE\|INTERFACE\|LINE\|PIPE&quot; &quot;log.txt&quot; &nbsp;| ./allot_fmt.pl &quot;$DATE&quot; &gt; log.csv</div></div>
<p>The script outputs CSV formatted data:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">timestamp;ifc;L1;P1;P10;P12;P2;P3;P4;P5;P8;P9;<br />
Thu Dec 10 14:48:00 CET 2009;Int;2779648;2599928;4608;;111760;1024;;9792;;52536;<br />
Thu Dec 10 14:48:00 CET 2009;Ext;8372424;5372392;206448;;2407264;60720;;258816;;66784;<br />
Thu Dec 10 14:48:12 CET 2009;Int;1909272;1699872;3776;;170624;512;;1216;;33272;<br />
Thu Dec 10 14:48:12 CET 2009;Ext;7932680;7370584;97152;;350920;36432;;12144;;65448;<br />
[..]</div></div>
<p>And here&#8217;s what it looks like when opened up in OpenOffice Calc (sorry, no fancy formatting).<br />
<a href="http://www.108.bz/wp-content/uploads/2010/04/Allot_NetEnforcer_bandwidth_reports.gif"><img src="http://www.108.bz/wp-content/uploads/2010/04/Allot_NetEnforcer_bandwidth_reports-300x181.gif" alt="NetEnforcer bandwidth report" title="NetEnforcer_bandwidth_report" width="300" height="181" class="alignnone size-medium wp-image-435" /></a><br />
The graph above shows that the 8Mbps link (the &#8220;Line&#8221;, in Allot&#8217;s parlance) is not saturated. Problem was that, during that timeframe, we were also trying to make <a href="http://en.wikipedia.org/wiki/Iperf">Iperf</a> &#8220;consume&#8221; all of the available bandwidth. We couldn&#8217;t make it because one of the firewalls was acting as a bottleneck if presented with certain workloads (many connections, see <a href="http://www.108.bz/posts/it/who-ate-all-the-bandwidth/">this</a>) . Being able to generate these kinds of report proved very useful in troubleshooting&#8230;</p>
<div class="codecolorer-container perl blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;height:300px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl </span><br />
<span style="color: #666666; font-style: italic;"># Giuliano - http://www.108.bz</span><br />
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@samples</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lastsample</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lastint</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009999;">&lt;STDIN&gt;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009966; font-style: italic;">s/[\r\n]*//g</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">next</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">$_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/$ARGV[0]/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$lastsample</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$lastsample</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$lastsample</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/push.html"><span style="color: #000066;">push</span></a> <span style="color: #0000ff;">@samples</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$lastsample</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#print &quot;$_\n&quot;;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/INTERFACE/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009966; font-style: italic;">s/^.*INTERFACE.*(Int|Ext)ernal.*$/$1/</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$lastint</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#print &quot;$lastint\n&quot;;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/LINE/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009966; font-style: italic;">s/^.*LINE\s*([0-9]+)\s*(\d+).*$/L$1;$2/</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$line</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$tput</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/split.html"><span style="color: #000066;">split</span></a> <span style="color: #ff0000;">';'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#print &quot;$line,$tput\n&quot;;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$lastsample</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$lastint</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$line</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$tput</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/PIPE/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009966; font-style: italic;">s/^.*PIPE\s*([0-9]+)\s*(\d+).*$/P$1;$2/</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$pipe</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$tput</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/split.html"><span style="color: #000066;">split</span></a> <span style="color: #ff0000;">';'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#print &quot;$pipe,$tput\n&quot;;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$lastsample</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$lastint</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$pipe</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$tput</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #000000; font-weight: bold;">STDERR</span> <span style="color: #ff0000;">&quot;wtf<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/exit.html"><span style="color: #000066;">exit</span></a><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$keys</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sample</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@samples</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$int</span> <span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/keys.html"><span style="color: #000066;">keys</span></a> <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$sample</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$key</span> <span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/keys.html"><span style="color: #000066;">keys</span></a> <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$sample</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$int</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$keys</span><span style="color: #339933;">-&gt;</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$key</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #339933;">@</span><a href="http://perldoc.perl.org/functions/keys.html"><span style="color: #000066;">keys</span></a> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/sort.html"><span style="color: #000066;">sort</span></a> <a href="http://perldoc.perl.org/functions/keys.html"><span style="color: #000066;">keys</span></a> <span style="color: #0000ff;">%$keys</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;timestamp;ifc;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$key</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><a href="http://perldoc.perl.org/functions/keys.html"><span style="color: #000066;">keys</span></a><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$key;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$sample</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@samples</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$int</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Int'</span><span style="color: #339933;">,</span><span style="color: #ff0000;">'Ext'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$sample-&gt;[0];&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$int;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$key</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><a href="http://perldoc.perl.org/functions/keys.html"><span style="color: #000066;">keys</span></a><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$sample-&gt;[1]-&gt;{$int}-&gt;{$key};&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<a href="http://perldoc.perl.org/functions/exit.html"><span style="color: #000066;">exit</span></a><span style="color: #339933;">;</span></div></div>
 <img src="http://www.108.bz/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=429" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.108.bz/posts/it/allot-netenforcer-bandwidth-reports/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Who ate all the bandwidth?</title>
		<link>http://www.108.bz/posts/it/who-ate-all-the-bandwidth/</link>
		<comments>http://www.108.bz/posts/it/who-ate-all-the-bandwidth/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 17:36:40 +0000</pubDate>
		<dc:creator>Giuliano</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Performance Monitoring]]></category>
		<category><![CDATA[Switching]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://www.108.bz/?p=370</guid>
		<description><![CDATA[Today Internet browsing is particularly slow. At seemingly random intervals, available bandwith drops down and people get more and more irritable. How do you find out why this is happening? The possible causes boil down to: Router/Firewall1 is not pleased by &#8220;something&#8221;. Could be an attack or a bug in the device firmware. Too many [...]]]></description>
			<content:encoded><![CDATA[<p>Today Internet browsing is particularly slow.<br />
At seemingly random intervals, available bandwith drops down and people get more and more irritable. <img src='http://www.108.bz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>How do you find out why this is happening?</p>
<p>The possible causes boil down to:</p>
<ol style="list-style-type: upper-alpha;">
<li style="list-style-type: upper-alpha;">Router/Firewall<sup class='footnote'><a href='#fn-370-1' id='fnref-370-1'>1</a></sup> is not pleased by &#8220;something&#8221;. Could be an attack or a bug in the device firmware.</li>
<li style="list-style-type: upper-alpha;">Too many connections. Maybe they&#8217;re not passing much traffic, but the internet gateway can&#8217;t keep up with their number. I&#8217;ve seen firewalls perform very badly in this respect. E.g.: 3 connections trying to download/upload as fast as they can, and a total, aggregate, b/w of 10Mbps. Those 3 plus 3000 &#8220;normal&#8221; connections and a total b/w of 6Mbps.</li>
<li style="list-style-type: upper-alpha;">A reasonable amount of connections, effectively eating all of the available bandwidth.</li>
</ol>
<p>I&#8217;ll skip case <b>A</b>, for now. <img src='http://www.108.bz/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
In case <b>B</b> you&#8217;ll likely want to know the firewall&#8217;s idea of &#8220;netstat&#8221;, meaning the complete listing of TCP/UDP/other connections. No big deal if the device has got some sort of CLI access: capture its output, import it into a spreadsheet, or use awk/sort/grep<sup class='footnote'><a href='#fn-370-2' id='fnref-370-2'>2</a></sup> to build your stats. Usually, computing total number of connections by source IP address and sorting accordingly, is enough to gain some insight about what&#8217;s going on.<br />
Case <b>C</b>&#8230; For long-running (days) data analysis, you could use a tool like <a href="http://www.ntop.org/">NTOP</a>. But if, like me today, you need to act quickly (perhaps because you know that the issue will disappear soon), <a href="http://www.ex-parrot.com/pdw/iftop/">iftop</a> can hardly be beaten.<br />
Both tools require the machine they run on to be able to &#8220;sniff&#8221; all the traffic passing through the firewall. This can be accomplished by configuring <i>monitoring</i>/<i>monitored</i> port(s) on a switch.  <i>Monitored</i> ports get their inbound/outbound traffic copied to the monitoring one. Different vendors call the thing a different way, <i>port mirroring</i> is also a good keyphrase. Here are a couple of resources:</p>
<ul>
<li>(Old) 3Com Superstack: <a href="http://blog.icewolf.ch/archive/2008/07/08/monitor-port-on-3com-4400.aspx">Monitor Port on 3Com 4400</a></li>
<li>HP ProCurve, pretty straightforward to set up using the &#8220;menu&#8221; interface:  <a href="http://www.hp.com/rnd/support/faqs/sw_208_224.htm#question25">How do I attach a LAN Analyzer to a Switch 208t/224t port to monitor LAN traffic for diagnostic purposes?</a></li>
<li>ProCurve switches are not limited to mirroring ports that belong to the same device/chassis: <a href="http://pro-h40060-hpwpux-pro.atlanta.hp.com/procurve/uk/en/pdfs/application-notes/AN-S14_ProCurve-intelligent-mirroring-final.pdf">How to configure remote and intelligent mirroring on ProCurve switches</a></li>
<li>
Low-end HP switches (like the ProCurve 1800 one I encountered here), though, are only manageable via a web gui:<br />
<div id="attachment_389" class="wp-caption alignnone" style="width: 310px"><a href="http://www.108.bz/wp-content/uploads/2010/03/procurve1800mirroring.png"><img src="http://www.108.bz/wp-content/uploads/2010/03/procurve1800mirroring-300x120.png" alt="Port Mirroring on a ProCurve 1800" title="procurve1800mirroring" width="300" height="120" class="size-medium wp-image-389" /></a><p class="wp-caption-text">Port Mirroring on a ProCurve 1800</p></div>
</li>
<li>Cisco: <a href="http://en.wikipedia.org/wiki/Port_mirroring">Port Mirroring</a>, <a href="http://itprofesionals.blogspot.com/2009/12/configuring-cisco-catalyst-switch-span.html">Configuring a Cisco Catalyst Switch SPAN mirroring port</a>
</li>
</ul>
<p>(You could as well use a hub instead of a switch and get implicit mirroring of any port, to any port of the hub. Just unplug the firewall, link the hub to the switch, plug firewall and monitoring host in the hub. Kludgy but quick and easy, if you can afford the temporary cabling changes, and the bottleneck introduced by the hub&#8230;)</p>
<p>So:
<ul>
<li>Find the switch where the firewall is connected to. Which side of the firewall? It depends on where you believe the issues originates from. Let&#8217;s say the culprit is most likely to lie on the LAN &rarr; switch port A.</li>
<li>Connect your laptop/monitoring machine to the same switch &rarr; port B.</li>
<li>Set up monitoring: port A is <i>monitored</i>, port B is <i>monitoring</i>.</li>
<li>Run iftop, maybe telling it to also show port numbers (&#8220;-P&#8221;, without this switch, you&#8217;ll only see totals by source/destination IP addresses couple), don&#8217;t display hostnames &#8220;-n&#8221;, the interface &#8220;-i eth0&#8243; and provide a meaningful filter (here I&#8217;m selecting packets whose source is not on the LAN<sup class='footnote'><a href='#fn-370-3' id='fnref-370-3'>3</a></sup>. The &#8220;-p&#8221; option instructs iftop to capture packets in <a href="http://en.wikipedia.org/wiki/Promiscuous_mode">promiscuous</a> mode. Without it, iftop won&#8217;t lift off the wire packets that aren&#8217;t addressed to the machine on which it is running.
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">iftop -p -P -n -i eth0 -f 'not src net 192.168.200.0/23'</div></div>
<p>Iftop will produce a realtime table of running connections, sorted by how demanding they are in terms of bandwidth (10s average, by default). See the screenshot below; the top connections are due to two running video conference streams stealing 1Mbit/second worth of bandwidth, each.<br />
<div id="attachment_394" class="wp-caption alignnone" style="width: 310px"><a href="http://www.108.bz/wp-content/uploads/2010/03/iftop.png"><img src="http://www.108.bz/wp-content/uploads/2010/03/iftop-300x193.png" alt="iftop output" title="iftop" width="300" height="193" class="size-medium wp-image-394" /></a><p class="wp-caption-text">iftop's output</p></div><br />
Once everything is set up and you&#8217;re able to read iftop&#8217;s output, spotting the &#8220;top talkers&#8221; of your net becomes kids play, enjoy!</p>
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-370-1'>for brevity, I&#8217;ll just say &#8220;firewall&#8221; from now on. <span class='footnotereverse'><a href='#fnref-370-1'>&#8617;</a></span></li>
<li id='fn-370-2'>Yuri is king at doing that. See his <a href="http://yurisk.info/2010/03/08/awk-weekly-checkpoint-anti-spam-statistics-or-viva-la-open-relays/">AWK weekly</a> series. <span class='footnotereverse'><a href='#fnref-370-2'>&#8617;</a></span></li>
<li id='fn-370-3'>iftop will still show these source addresses, since its output is always made of bidirectional &#8220;connections&#8221;. Only, counters pertaining to the LAN &rarr; outside direction, won&#8217;t increase. <span class='footnotereverse'><a href='#fnref-370-3'>&#8617;</a></span></li>
</ol>
</div>
 <img src="http://www.108.bz/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=370" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.108.bz/posts/it/who-ate-all-the-bandwidth/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

