Forum Discussion
mhuss3y_61750
Nimbostratus
Jun 05, 2009Profile fallback statistics
I have a profile with fallback configured. Is there a way I can view/record the number of times fallback occurs or the profile is invoked?
The_Bhattman
Nimbostratus
Jun 08, 2009Well you could do it if you assume the fall back is working when there is a LB failure.
The following will trigger everytime the LB_FAILED event is triggered which assumes the fall back host is properly working)
when RULE_INIT {
log local0. "Initialize the count of requests: [STATS::set fallback "current_count" 0]"
set ::count 0
}
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/give-me-stats-baby" } {
set html_content "Fallback StatisticsIncremented the current count to: [STATS::incr fallback 'current_count']"
HTTP::respond 200 content $html_content
}
}
when LB_FAILED {
log local0. "Incremented the current count to: [STATS::incr fallback "current_count"]"
}
The output will be:
Rule stats_rule : Incremented the current count to: 100
You can also go further by adding /give-me-stats-baby it will output the count via HTML. However please be aware that if you reboot or re-initialize the irule it will go straight back to 0. Also keep in mind that I have tested this so there might be some syntax issue but the general logic is there.
Hope this helps,
CB
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