Forum Discussion
Al_s_296685
Nimbostratus
Oct 08, 2017F5 BIG-IP Irule - redirect to individual node for external monitoring
Hi all
I'm looking at implementing an external monitoring solution whereby we do something like the following
read the URI and see if it contains formatting like this "/monitoring/servername" ...
Al_s_296685
Nimbostratus
Oct 09, 2017ok, im getting there towards answering my own question.
any refinements on this would be appreciated:
when HTTP_REQUEST {
Check if path contains /monitoring
if {[HTTP::path] contains "/monitoring/"}{
use getfield to split the uri based on monitoring/ and then return the server name after that
set server_id [getfield [HTTP::uri] "monitoring/" 2 ]
log local0. "Server id: $server_id"
Replace /monitoring and servername in the path
set toremove [string range [HTTP::uri] [expr {[string first "/monitoring/" [HTTP::uri]]}] end]
log local0. "part of uri to remove: $toremove"
set replace "/"
set uri [string map [list $toremove $replace] [HTTP::uri]]
log local0. "New URI = $uri"
HTTP::uri $uri
redirect or rewrite uri?
HTTP::redirect "http://[HTTP::host]$uri"
pool "/Common/${server_id}"
}
}
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