Forum Discussion
Joel_Moses
Nimbostratus
Dec 07, 2009Determining 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 exactly clear on whether there's a way to do it.
6 Replies
- The_Bhattman
Nimbostratus
I suppose you can do a catch statement against STATS::get . However, that would assume that the profile on exists with a specific common field. It's not ideal but I am throwing it out there - Joel_Moses
Nimbostratus
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.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 } } }
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 } } }
- hoolio
Cirrostratus
It would be useful to have a way to determine the name of the stats profile from an iRule. If this isn't possible, you could open a case with F5 Support and ask them to consider adding this functionality in a future release.when HTTP_REQUEST { log local0. "\[virtual name\]: [virtual name]" log local0. "vip stats profile name: [virtual name]_stats" log local0. "vip stats profile field1 value: [STATS::get [virtual name]_stats field1]" log local0. "vip stats profile field1 value incr: [STATS::incr [virtual name]_stats field1]" log local0. "vip stats profile field1 value: [STATS::get [virtual name]_stats field1]" }
- GavinW_29074
Nimbostratus
Hey, - Michael_Yates
Nimbostratus
Hi GavinW, - GavinW_29074
Nimbostratus
Michael
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