fraguet_53463
Jul 06, 2012Nimbostratus
Using one statistic profile in severals vs
Hello
First..... be indulgent with my english... I'm french
I wonder if we can assign a same statistic profile in several virtuals servers.
I explain my case :
I have an internet application divided in two séparates ways. One for smartphones user-agent and one for non-smartphones user-agent.
Smartphones users are asking if they want to go to the smartphone environnement or in the classic environnement when they access by the classic way.
This will be a new offer, so the communication department wants to have statistics of numbers of smartphones users accessing via classic way, how many accepts redirection to smartphones application and how many prefers using the classic one.
So...
On the virtual server acceding the classic application I have configured a statistic profile which contains 3 fields. I have writen an Irule which modify two of the three fields and makes a html page presenting the stats (based on the exemple give in the dev central).
It works well.
The third field of the profile has to be modify with another Irule applies in the virtual server acceding the smartphone application.
But when I apply the second Irule and the same statistic profile in the second virual server, the visualisation of the html page gives erratics, changing and wrong information.
Each refresh of the getstat page give different values even if no traffic is made on the two vs.
So I wondering if we can use the same statistic profile in two differents VS.
My statistic profile name : conn_mobiles
the fields are :
- conn_mobile
- access_mobile
- access_classic
here is my first Irule applies in the classic application VS:
"
when HTTP_REQUEST {
switch [HTTP::uri] {
"/" {
if { [matchclass [HTTP::header User-Agent] contains $::user_mobile] } {
STATS::incr conn_mobiles conn_mobile 1
HTTP::uri "/PortailClassic/AskIfAccessMobileApplication.jsp"
}
}
"/PortailClassic/" {
if { [matchclass [HTTP::header User-Agent] contains $::user_mobile] } {
STATS::incr conn_mobiles conn_mobile 1
HTTP::uri "/PortailClassic/AskIfAccessMobileApplication.jsp"
}
}
"/PortailClassic/LoginClassic" {
STATS::incr conn_mobiles access_classic 1
HTTP::uri "/PortailClassique/login"
}
"/getstats" {
HTTP::respond 200 content "
Statistiques connexions mobiles
Nombre acces mobiles via site classique [STATS::get conn_mobiles conn_mobile]
Nombre acces mobiles via site classique [STATS::get conn_mobiles access_mobile]
Nombre connexions mobiles sur site classique [STATS::get conn_mobiles access_classic]
"
}
"/resetstats" {
STATS::set conn_mobiles conn_mobile 0
STATS::set conn_mobiles access_mobile 0
STATS::set conn_mobiles access_classic 0
HTTP::respond 200 content "
HTTP Status Code Control
Statistiques remises a zero
"
}
default {
HTTP::uri [HTTP::uri]
}
}
}
"
The second Irule applies in the second VS :
"when HTTP_REQUEST {
if {[HTTP::uri] eq "/PortalMobile/"} {
STATS::incr conn_mobiles access_mobile 1
}
}
"
in this case, without any connexion, when I refresh the /getstats page it gives :
conn_mobile : 1
access_mobile : 0
access_classic : 0
another refresh makes
conn_mobile : 0
access_mobile : 0
access_classic : 1
the following refresh
conn_mobile : 0
access_mobile : 0
access_classic : 0
And so on.