Forum Discussion
Joel_Moses
Nimbostratus
17 years agoDetermining stats profile name for VS
Is there any way within an iRule to detect the Statistics profile set for the current VS? I'd assumed there would be a [PROFILE:: exists stats] or something similar, but there isn't. The Wiki isn't ex...
Joel_Moses
Nimbostratus
17 years agoLack 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. üòÜ
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects