iRule to disable VIP with less then X members a pool
Create and iRule to disable a vip or stop sending traffic to a vip with less then 3 members in the ltm pool. I have a WIP test.company.com with two VIPS, vip1 is in datacenter1 (dc1) and vip2 is in datacenter2 (dc2). The ltm's in the two datacenters do not communicate or share the same ip space, but the gtm's in the two dc's are in the same sync group and can communicate. Since the LTM's can't communicate I can't use priority groups and need a way to make the vip failover to the other DC.
Datacenter 1 HA gtm’s – sync group “group” HA ltm’s – don’t have communication to ltm’s in datacenter 2
Datacenter 1 HA gtm’s – sync group “group” HA ltm’s – don’t have communication to ltm’s in datacenter 1
Scenario - Wip name = test.company.com, Wip pool = "test_pool" - lb method on pool is global availability, Members in this pool are "VIP" from dc1 and "VIP" from dc2, all traffic needs to go to vip in dc1 unless down.
LTM’s in dc1 has a VIP = testvip-dc1, Pool = testpool-dc1 with 4 members in the pool (different pool members than dc2)
LTM’s in dc2 has a VIP = testvip-dc2, Pool = testpool-dc2 with 4 members in the pool (different pool members than dc1)
Due to capacity issues, when "testpool-dc1" has only two members available I need to stop sending traffic to the vip in dc1 and start sending traffic to the VIP in dc2
I have written some valid irules and applied them to the VIP's but they don’t seem to work. I think I need an iRule on the GTM, but I'm not sure. below are some examples I have created for the vips
when HTTP_REQUEST { if { [ active_members [ LB::server pool ] ] <=2 } { pool testpool-dc1 } else { [ LB::server ] [ LB::down ] }
}
when CLIENT_ACCEPTED { if { [ active_members testpool-dc1 ] <= 2 } { LB::down }
}
I’m probably way off on my irule so any help on writing the irule and where to assign it (ltm or gtm ) would be great.