Forum Discussion
Kevin_Basler
Aug 24, 2021Altostratus
iRule logic to use multiple pools to force GTM failover on VIP
I have a VIP that has no status because the pool that it uses is determined by a policy. To add state to the VIP I've added the following iRule: when HTTP_REQUEST { if { [active_members pool1]...
Aug 25, 2021
Hi Kevin,
- Create an iRule:
ltm rule irule_poolstatus {
when HTTP_REQUEST {
if { [active_members pool1] == 0 || [active_members pool2] == 0 || [active_members pool3] == 0 || [active_members pool4] == 0} {
HTTP::respond 200 content "down"
}
else {
HTTP::respond 200 content "up"
}
}
}
- Create a Virtual Server with IP x.y.z.t and bind the iRule:
ltm virtual vs_poolstatus {
destination 1.2.3.4:http
ip-protocol tcp
mask 255.255.255.255
profiles {
http { }
tcp { }
}
rules {
irule_poolstatus
}
serverssl-use-sni disabled
source 0.0.0.0/0
source-address-translation {
type automap
}
translate-address enabled
translate-port enabled
}
- Create a monitor with receive string:
ltm monitor http monitor_status {
adaptive disabled
defaults-from http
interval 5
ip-dscp 0
recv up
recv-disable none
send "GET /\r\n"
time-until-up 0
timeout 16
}
- Create a pool, add the virtual server IP address as pool member and bind the monitor:
ltm pool pool_status {
members {
1.2.3.4:http {
address 1.2.3.4
session monitor-enabled
}
}
monitor monitor_status
}
- Create second iRule:
when HTTP_REQUEST {
if { [active_members pool_status] == 0} {
# log
}
}
- Add the iRule to main virtual server
first iRule and virtual server: for "up/down response"
pool and monitor: for receive a request to the virtual server and to see the "up/down" status
I couldn't find a shorter solution.
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