Forum Discussion
Joel_Moses
Dec 07, 2009Nimbostratus
Lack of a [STATS::profilename] that contains the name of the current VS's statistics profile or a [PROFILE::statisics exists] is a big problem. Means that you're forced to create a distinct stats collection iRule for each profile, rather than a single iRule that can determine which statistics profile to write to in the context of its VS.
So if I wanted to have an iRule simply add values to the current VS's configured Statistics profile, I could reuse this rule if I could do [STATS::profilename]:
when HTTP_REQUEST {
set t0 [clock clicks -milliseconds]
}
when HTTP_RESPONSE {
set t1 [clock clicks -milliseconds]
set total_time [expr $t1 - $t0]
STATS::incr [STATS::profilename] "num_requests" 1
STATS::incr [STATS::profilename] "total_time" $total_time
switch -glob [HTTP::status] {
"20*" {
STATS::incr [STATS::profilename] "count_20x" 1
}
"30*" {
STATS::incr [STATS::profilename] "count_30x" 1
}
"40*" {
STATS::incr [STATS::profilename] "count_40x" 1
}
"50*" {
STATS::incr [STATS::profilename] "count_50x" 1
}
}
}
But since I don't seem to have the ability to detect the profile for the currently active VS, I'm having to create multiple iRules like this:
when RULE_INIT {
set ::stat_profile "active_site1_page_delay"
}
when HTTP_REQUEST {
set t0 [clock clicks -milliseconds]
}
when HTTP_RESPONSE {
set t1 [clock clicks -milliseconds]
set total_time [expr $t1 - $t0]
STATS::incr $::stat_profile "num_requests" 1
STATS::incr $::stat_profile "total_time" $total_time
switch -glob [HTTP::status] {
"20*" {
STATS::incr $::stat_profile "count_20x" 1
}
"30*" {
STATS::incr $::stat_profile "count_30x" 1
}
"40*" {
STATS::incr $::stat_profile "count_40x" 1
}
"50*" {
STATS::incr $::stat_profile "count_50x" 1
}
}
}
Unless I'm missing something. And that's more than likely. üòÜ