Forum Discussion
eLeCtRoN
May 08, 2018Cirrus
iRule for Version check with dependent pool selection
Hello,
I have a scenario, my web developers want a dynamic pool selection which depents on a Version No., my idea was to make a curl get request with credentials (with a simple http basic auth) and...
youssef1
May 10, 2018Cumulonimbus
Hello Manuel,
 
I'am sorry for te delate I was off :-). So you can use sideband connections:
 
https://clouddocs.f5.com/api/irules/SIDEBAND.html
 
Using this command (1.1.1.1 will be your backend. just be carefull, sideband working only in http:
 
$1
 
So I write your an Irule that allow you to retrieve version from backend node. I have not tested it but you have all elements that allow you to go ahead. Below Irule you need:
 
when HTTP_REQUEST {
following code allow you to connect to your backend (1.1.1.1 1.1.1.1 will be your backend server in the pool)
if {[catch {connect -timeout 1000 -idle 30 -status conn_status 1.1.1.1:80} conn_id] == 0 && $conn_id ne ""}{
log local0. "Connect returns: $conn_id and conn status: $conn_status"
} else {
log local0. "Connection could not be established to backend node"
}
we set var tha we will send to backend, you can use post, get put as you want (mybackend_hostname.com will be the backend hostname)
set data_validate "GET /info HTTP/1.1\r\nHost: mybackend_hostname.com\r\nConnection: keep-alive\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36\r\nAccept-Language: fr,en;q=0.9\r\n\r\n"
we sent date
set send_bytes [send -timeout 1000 -status send_status $conn_id $data_validate]
log local0. "AAA Sent $send_bytes with status $send_status"
we receive data
set recv_data [recv -timeout 1000 $conn_id]
log local0. "1 - ([string length $recv_data]): $recv_data"
retrieve version info from response
regexp {.*\"sourceGuid\":[^\"]+\"([^\"]+)\"} $recv_data -> version
log local0. "Node version $version"
}
Let me now if you need additional help in order to finalize your irule.
 
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