<?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>JasonSamuel.com &#187; nsconmsg</title>
	<atom:link href="http://www.jasonsamuel.com/tag/nsconmsg/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonsamuel.com</link>
	<description>Cool stuff I see in the IT world</description>
	<lastBuildDate>Wed, 25 Jan 2012 21:05:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>How to monitor realtime traffic stats accurately on a Citrix Netscaler</title>
		<link>http://www.jasonsamuel.com/2010/07/09/how-to-monitor-realtime-traffic-stats-accurately-on-a-citrix-netscaler/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-monitor-realtime-traffic-stats-accurately-on-a-citrix-netscaler</link>
		<comments>http://www.jasonsamuel.com/2010/07/09/how-to-monitor-realtime-traffic-stats-accurately-on-a-citrix-netscaler/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 17:07:45 +0000</pubDate>
		<dc:creator>Jason Samuel</dc:creator>
				<category><![CDATA[Citrix NetScaler]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[connectiontable]]></category>
		<category><![CDATA[netscaler]]></category>
		<category><![CDATA[nsconmsg]]></category>

		<guid isPermaLink="false">http://www.jasonsamuel.com/?p=504</guid>
		<description><![CDATA[The GUI on a Citrix Netscaler is nice but it takes 7 seconds to update and sometimes you need live stats and a 7 second delay is not going to work for you. You can do A LOT through command line you can&#8217;t through the GUI (isn&#8217;t that the case with pretty much anything though? [...]<p><a href="http://www.jasonsamuel.com/2010/07/09/how-to-monitor-realtime-traffic-stats-accurately-on-a-citrix-netscaler/">How to monitor realtime traffic stats accurately on a Citrix Netscaler</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>

More of my posts you might like:<ol>
<li><a href='http://www.jasonsamuel.com/2010/06/22/how-to-update-your-citrix-netscaler-firmware/' rel='bookmark' title='How to update your Citrix Netscaler firmware'>How to update your Citrix Netscaler firmware</a></li>
<li><a href='http://www.jasonsamuel.com/2010/06/22/how-to-reset-a-citrix-netscaler-back-to-factory-defaults/' rel='bookmark' title='How to reset a Citrix Netscaler back to factory defaults'>How to reset a Citrix Netscaler back to factory defaults</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The GUI on a Citrix Netscaler is nice but it takes 7 seconds to update and sometimes you need live stats and a 7 second delay is not going to work for you.  You can do A LOT through command line you can&#8217;t through the GUI (isn&#8217;t that the case with pretty much anything though? <img src='http://www.jasonsamuel.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).   I am writing this article to show you how to get stats on each of your VIPS and servers quickly and also monitor live connections and traffic into your appliance.</p>
<p>&nbsp;</p>
<p><a href="http://www.jasonsamuel.com/wp-content/uploads/2010/06/citrix-netscaler.jpg"><img src="http://www.jasonsamuel.com/wp-content/uploads/2010/06/citrix-netscaler.jpg" alt="" title="citrix-netscaler" width="313" height="90" class="aligncenter size-full wp-image-460" /></a></p>
<p>&nbsp;</p>
<p><strong>GETTING DETAILS</strong><br />
First, you might want to get some details on your Load Balanced VIP.  I am calling my Load Balanced VIP &#8220;lb_vsvr_name&#8221; in this example.  Here is how you do that:</p>
<p>1. SSH into the Netscaler using Putty<br />
2. Type:</p>
<p><code>sh lb vserver lb_vsvr_name</code></p>
<p>You will immediately see a lot of stats on how this VIP is configured like it&#8217;s IP, it&#8217;s status, connection method, persistency, bound service groups, etc.  Pay attention to the bound service groups.  So to get details on one of those, type this where &#8220;svcgrp_name&#8221; is the name of your service group:</p>
<p>3. Now type:</p>
<p><code>sh servicegroup svcgrp_name</code></p>
<p>This will show you details on the service group such as the status and the individual back end servers.  Let&#8217;s say you have two servers called &#8220;svr_name1&#8243; and &#8220;svr_name2&#8243;.  To get the details on those backend servers:</p>
<p>4. Type:</p>
<p><code>sh server svr_name1</code></p>
<p>and</p>
<p><code>sh server svr_name2</code></p>
<p>This will pull up stats on each of your backend servers.</p>
<p>&nbsp;</p>
<p><strong>GETTING REALTIME GENERAL PERFORMANCE STATS</strong><br />
1. Make sure you are still SSHed into the Netscaler using Putty<br />
2. Type &#8220;shell&#8221; to enter the FreeBSD shell<br />
3. Capitalization matters below or you will get an error. Type:</p>
<p><code>nsconmsg -s ConLB=2 -d oldconmsg</code></p>
<p>What this does is pull up realtime general stats on all your VIPs and services and continues to update it every 7 seconds until your press Ctrl+C to stop it. I know the display has a ton of info in it but Citrix actually has some very good documentation on how to read it all here:  <a href="http://support.citrix.com/article/CTX113341">http://support.citrix.com/article/CTX113341</a></p>
<p>&nbsp;</p>
<p><strong>GETTING REALTIME TRAFFIC &amp; CONNECTION STATS</strong><br />
Now that you have verified the VIP is up and have it&#8217;s IP and bound service groups.  Here is how you can SSH into the Netscaler and get live traffic and connection stats for the VIP itself:</p>
<p>1. Make sure you are still SSHed into the Netscaler using Putty<br />
2. Make sure you are not in the shell.  Type &#8220;exit&#8221; if you are still in it from doing the previous section.<br />
3. Now type:</p>
<p><code>shconnectiontable</code></p>
<p>This will give you every connection coming into the Netscaler.  The columns displayed are in this order:</p>
<p>SRCIP = source IP address<br />
SRCPORT = source port<br />
DSTIP = destination IP address<br />
DSTPORT = destination port<br />
SVCTYPE = service type like HTTP, SSL, etc.<br />
IDLTIME = idle time of that connection in milliseconds<br />
STATE = current state of the connection, you will usually see it either waiting or established</p>
<p>Pretty hard to look at if the device you are looking at is in production and has a ton of traffic on it.  So we need to filter this display.  Let&#8217;s just look at how many connections we have to just one of the backend servers above.  Type:</p>
<p><code>sh connectiontable | grep xxx.xxx.xxx.xx</code></p>
<p>or</p>
<p><code>sh connectionable &quot;ip == xxx.xxx.xxx.xx&quot;</code></p>
<p>where xxx.xxx.xxx.xxx is the IP address of one of the backend servers above.  This will give you stats on all the connections to that backend server.</p>
<p>1. Anything that says &#8220;MONITOR&#8221; is the Netscaler itself testing for uptime so ignore those.<br />
2. If you see &#8220;MONITORS&#8221;, ignore those too, they are just SSL based monitors.<br />
3. If you see &#8220;HTTP&#8221; or &#8220;SSL&#8221;, that&#8217;s the real traffic you are after.  Note if they say &#8220;TIME_WAIT&#8221; or &#8220;ESTABLISHED&#8221;.  If it&#8217;s live traffic, the state should be an established connection.</p>
<p>Let&#8217;s get into some more advanced filtering.  Let&#8217;s say you want to filter all monitors to that IP and only display SSL, HTTP, etc:</p>
<p><code>sh connectiontable &quot;ip == xxx.xxx.xxx.xxx &amp;&amp; svctype != MONITOR&quot;</code></p>
<p>Let&#8217;s say you want to see all traffic to that IP but only established connections.  Here is the syntax for that:</p>
<p><code>sh connectiontable &quot;ip == xxx.xxx.xxx.xxx &amp;&amp; state == established&quot;</code></p>
<p>Let&#8217;s say I want all the traffic to that IP, established connections only, and only display SSL connections:</p>
<p><code>sh connectiontable &quot;ip == xxx.xxx.xxx.xxx &amp;&amp; state == established &amp;&amp; svctype == SSL&quot;</code></p>
<p>&nbsp;</p>
<p>One thing to note, typically you can filter additional service types like this:</p>
<p><code>sh connectiontable &quot;ip == xxx.xxx.xxx.xxx &amp;&amp; svctype != MONITOR &amp;&amp; svctype != SSL&quot;</code></p>
<p>but I found that if you have &#8220;MONITORS&#8221; and you wanted to filter them, it does not work and gives you an error saying it&#8217;s an invalid command. I actually have an open ticket with Citrix about this bug so it should be fixed in a future release.  In the meantime, just use a combination of a filter expression and grep to filter it out.  Here&#8217;s an example:</p>
<p><code>sh connectiontable &quot;ip == xxx.xxx.xxx.xxx &amp;&amp; svctype != MONITOR&quot; | grep -v MONITORS</code></p>
<p>&nbsp;</p>
<p><strong>FURTHER READING</strong><br />
If you need further info on commands and syntax available on the Netscaler, I have hosted the Citrix Netscaler Command Reference Guide for 9.1 here:</p>
<p><a href='http://www.jasonsamuel.com/wp-content/uploads/2010/07/NS-CommandReference-Guide.pdf'>NS-CommandReference-Guide.pdf</a></p>
<p>Yes it&#8217;s 1742 pages but take the time to flip through it.  It&#8217;s extremely powerful. The connectiontable related syntax begins on page 883 (873 in the guide). <img src='http://www.jasonsamuel.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.jasonsamuel.com/2010/07/09/how-to-monitor-realtime-traffic-stats-accurately-on-a-citrix-netscaler/">How to monitor realtime traffic stats accurately on a Citrix Netscaler</a> is a post from: <a href="http://www.jasonsamuel.com">JasonSamuel.com</a></p>
<p>More of my posts you might like:<ol>
<li><a href='http://www.jasonsamuel.com/2010/06/22/how-to-update-your-citrix-netscaler-firmware/' rel='bookmark' title='How to update your Citrix Netscaler firmware'>How to update your Citrix Netscaler firmware</a></li>
<li><a href='http://www.jasonsamuel.com/2010/06/22/how-to-reset-a-citrix-netscaler-back-to-factory-defaults/' rel='bookmark' title='How to reset a Citrix Netscaler back to factory defaults'>How to reset a Citrix Netscaler back to factory defaults</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.jasonsamuel.com/2010/07/09/how-to-monitor-realtime-traffic-stats-accurately-on-a-citrix-netscaler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.jasonsamuel.com @ 2012-02-09 17:57:57 -->
