Forum Discussion

nixwiz_67532's avatar
nixwiz_67532
Icon for Nimbostratus rankNimbostratus
May 22, 2013

Getting different results when querying a statistics profile

We have developed an iRule that will look at the User-Agent header and if the request is coming from a mobile device/app then the URI gets changed and different file gets sent to the client. But, as part of this usage, we wanted to get a feel for how many times users requested documents and how many of those were mobile. We created a Statistics Profile named breakthroughs_presentations with two fields, count and count_mobile and it is attached to the same virtual server as the following iRule:

 

 

when HTTP_REQUEST {

 

if { ( [HTTP::uri] starts_with "/about/events-education/breakthroughs/2013/connection-cafe/presentations/" ) } {

 

if { [HTTP::uri] eq "/about/events-education/breakthroughs/2013/connection-cafe/presentations/stats" } {

 

log local0. "Requesting stats count is [STATS::get breakthroughs_presentations count]"

 

HTTP::respond 200 content "

 

 

Breakthroughs Presentations Statistics Page

 

Client Type Counters

 

Total Requests: [STATS::get breakthroughs_presentations count]

 

 

Mobile App Requests: [STATS::get breakthroughs_presentations count_mobile]

 

 

 

"

 

}

 

elseif { [HTTP::uri] eq "/about/events-education/breakthroughs/2013/connection-cafe/presentations/reset" } {

 

log local0. "Resetting Breakthroughs Presentations Statistics"

 

STATS::set breakthroughs_presentations count

 

STATS::set breakthroughs_presentations count_mobile

 

HTTP::respond 200 content "

 

 

Breakthroughs Presentations Statistics Reset

 

Breakthroughs Presentations Statistics have been reset to zeros

 

 

"

 

}

 

Only log for now if we make it past the statstics

 

log local0. "[IP::client_addr]:[TCP::client_port] (UA: [HTTP::header "User-Agent"] -> [HTTP::host][HTTP::uri]"

 

if { ( [HTTP::header "User-Agent"] contains "CFNetwork" ) or ( [HTTP::header "User-Agent"] contains "BlackBerry" ) } {

 

This appears to be the mobile app, change the URI

 

STATS::incr breakthroughs_presentations count_mobile

 

set newpath "/about/events-education/breakthroughs/2013/mobile/presentations/[URI::basename [HTTP::uri]]"

 

HTTP::uri $newpath

 

}

 

else {

 

Not the mobile app, so just increment the counter and leave the URI alone

 

STATS::incr breakthroughs_presentations count

 

}

 

}

 

}

 

 

The problem I am having is that hitting the /stats reporting page shows different numbers than what is shown by viewing the profile statistics in the GUI and sometimes change by just reloading the page. Using a different browser also can show different numbers. For example, checking the GUI at this moment shows count = 14 and count_mobile = 5, while my IE session says 1 and 0, respectively and my Chrome session reports 1 and 1.

 

 

Am I missing something?

 

2 Replies

  • i think because of cmp.

     

     

    10.0, statistics profiles are not fully CMP compatible. Each TMM instance uses a separate instance of the statistic profile. The cumulative counts are shown in the GUI and when polled via SNMP.CMP Compatibility (Statistics Profiles)

     

    https://devcentral.f5.com/wiki/iRules.cmpcompatibility.ashx