Forum Discussion
Simon_Wright_85
Nimbostratus
Jun 25, 2007Displaying stats using HTTP::respond
Hi all
I am in the process of looking to display some performance statistics i want to gather in a statistics profile. I am able to gather statistics and can view them when looking at it through the GUI. When i try to use an iRule to display it as suggested in the following thread i just get an error.
http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&forumid=5&postid=5916
Currently my test rule is as follows.
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/myteststats" } {
set stats_html "Total Users: $tot_users"
set html_content "iRule Statistics$stats_html"
HTTP::respond 200 content $html_content
}
}
All i seem to get back is an error. If i change $tot_users to generic text it works fine but i cannot seem to get data from the statistics profile. Im probably missing something quite simple but i have not been able to find anything on devcentral that talks about it other than the post linked above.
many thanks in advance.
Simon
- Simon_Wright_85
Nimbostratus
I realised my error and found the rule should look like this instead.when HTTP_REQUEST { if { [HTTP::uri] starts_with "/myteststats" } { set stats_html "Total Users: [STATS::get MyStatsProfile tot_users]" set html_content "iRule Statistics$stats_html" HTTP::respond 200 content $html_content } }
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