Forum Discussion

Steven_87308's avatar
Steven_87308
Icon for Nimbostratus rankNimbostratus
Jan 14, 2011

Stats Profile tutorial?

I am trying to capture one client's public IP's traffic: Current, Average, and Max bandwidth & connections. It looks like using StatsProfiles would be the way to go, but I'm stuck on the iRule. I've pored over Joe's article 66, but it's a bit steep for a guy who seldom does scripting. Is there a tutorial that maps the fields in the stats profile to an iRule?

 

 

TCPDump shows a LOT of traffic, but I want to trend it. Would it be easier to skip the iRule if I have InterMapper? (Five [probes] for Free!) It can do nice charting like Cacti, and can do SNMP readily. That is, is there an OID for the fields in StatsProfiles such that SNMP could pick up those stats?

 

 

Thus far my StatsProfile is named "ClientStats" and my fields are "CPS-Current, CPS-Av, CPS-Max, BWPS-Current, BWPS-Av, BWPS-MAX.

 

 

The things that throw me in Joe's66 are the "switch string to lower" (lower what?) and the reporting: once stats are gathered, does it show up in the gui automatically, or is it called as a named page in the gui?

 

But to the point, where's the incrementing done? Is it in the Http_Response? I could cull the timing/clock stuff, but the line STATS::incr looks crucial.

 

 

Where to begin? I've attached my feeble attempt thus far.

 

 

-Steve in SD

 

  • Also, it's delivered via HTML from the actual LTM. That's the point of his switch statement in the HTTP_REQUEST event.
  • Ah, "toLower" makes some sense -- thanks!

     

     

    Hmmm.. So Joes' sample66 is based on returns from the server, so a 404 would populate the "40" section. Makes sense, too, now that I see it that way.

     

     

    Yep, I saw that rather daunting page of commands. The trick is to put them together in an iRule. Oy. Yes, any help you could offer would be most helpful and I'd be most grateful.

     

     

    Given that my LTMs are still running v9.8.x, the manual offers some generic help...

     

    http://support.f5.com/kb/en-us/prod...ml1197706

     

     

    ... but it's not exactly a tutorial that maps the fields to the iRule commands; a bit too generic.

     

     

    Chris, based on your second response, by "delivered," it sounds like you mean that the page is presented in the LTM on demand.

     

     

    Thanks for the clarifications.

     

    Cheers,

     

    Steve
  • Steven, if you ware looking at capturing bandwidth, how do you go about getting that information from within an iRule? The HTTP profile can help with the "HTTP::payload length" command but I don't think storing those in a stats profile is the best route here. Also, if you want to go that route, you'll have to code your iRule to batch up all the payload into a single buffer (in most cases requests will be sent in subsequent chunks and then processing by the backend servers when all chunks are sent. An iRule is a great place if you want to keep running totals, but building a reporting system with averages, max, etc is likely going to be tough as that data isn't readily accessible from within an iRule.

     

     

    Generally we see customers go the iControl route (external management API) and build a separate application that gathers the statistics for the various objects they are wanting to report on. From the iControl API, one can get the total connects, bytes, etc. From there, one can calculate rates based on the difference over time of subsequent queries.

     

     

    Now, if you want to do things like keeping track of of requests, etc, then an iRule is a great place. Just trying to build in rates (averages over time) will be difficult to do.

     

     

    -Joe

     

  • I guess that's what I am looking for; a way to get that bandwidth data. Until I get up to v10.x, I won't have an iControl to use, if I understand my versions correctly.

     

    -Steve
  • iControl is our remote API that has been on every version of LTM since 4.0. Think of it like our SNMP interface except that it's web services based. You can use perl, java, .Net, Python, Ruby, and many other languages as a client toolkit. Check out the iControl Wiki for more information

     

     

    http://devcentral.f5.com/wiki/default.aspx/iControl.HomePage

     

     

    -Joe

     

  • So iControl has always been in there, eh? Hmm.. thanks for the info. I'm not seeing a lot of ASP.NET examples in there. Maybe my dev guy could put something on his back burner, who knows.

     

    -Steve