Disable pool member using iRule
Hey Everyone,
I'm trying to disable a pool member using an HTTP request, so that my team and I don't need to be awake and online for server maintenance. Below are both of the rules I've tried to use to accomplish this. The second one works, but comes up on the next health check and the first one doesn't work at all.
These requests trigger off of an HTTP request like this http://10.10.10.100/down/10.15.15.150
I've included the logs that come up after using each iRule
when HTTP_REQUEST {
if {[scan [HTTP::uri] "/down/%s" server] == 1} {
LB::down node $server
log local0. "URI: [HTTP::uri] MATCHED. server=$server"
}
}
Nov 17 14:55:33 slb10mddcwi info tmm2[16157]: Rule /Common/PoolMemberDisable : URI: /down/10.15.15.150MATCHED. server=10.15.15.150
when HTTP_REQUEST {
if {[scan [HTTP::uri] "/down/%s" server] == 1} {
LB::down pool SOMEPOOL member $server 80
log local0. "URI: [HTTP::uri] MATCHED. server=$server"
}
}
Nov 17 14:53:28 slb10mddcwi err tmm1[16157]: 01010028:3: No members available for pool /Common/TestPoolForiRule
Nov 17 14:53:28 slb10mddcwi info tmm1[16157]: Rule /Common/PoolMemberDisable : URI: /down/10.15.15.150MATCHED. server=10.15.15.150 Nov 17 14:53:28 slb10mddcwi notice mcpd[6310]: 01070638:5: Pool /Common/TestPoolForiRule member /Common/172.18.95.107:80 monitor status iRule down. [ /Common/http: up ] [ was up for 0hr:0min:26sec ] Nov 17 14:53:28 slb10mddcwi notice mcpd[6310]: 01071682:5: SNMP_TRAP: Virtual /Common/TestVSForiRule has become unavailable Nov 17 14:53:28 slb10mddcwi notice mcpd[6310]: 01071912:5: Virtual Address /Common/10.10.10.100 general status changed from GREEN to RED. Nov 17 14:53:28 slb10mddcwi notice mcpd[6310]: 01071913:5: Virtual Address /Common/10.10.10.100 monitor status changed from UP to DOWN. Nov 17 14:53:28 slb10mddcwi err tmm2[16157]: 01010028:3: No members available for pool /Common/TestPoolForiRule Nov 17 14:53:28 slb10mddcwi err tmm3[16157]: 01010028:3: No members available for pool /Common/TestPoolForiRule Nov 17 14:53:28 slb10mddcwi err tmm[16157]: 01010028:3: No members available for pool /Common/TestPoolForiRule Nov 17 14:53:28 slb10mddcwi notice mcpd[6310]: 01070727:5: Pool /Common/TestPoolForiRule member /Common/172.18.95.107:80 monitor status up. [ /Common/http: up ] [ was iRule down for 0hr:0min:0sec ] Nov 17 14:53:28 slb10mddcwi notice mcpd[6310]: 01071681:5: SNMP_TRAP: Virtual /Common/TestVSForiRule has become available Nov 17 14:53:28 slb10mddcwi err tmm1[16157]: 01010221:3: Pool /Common/TestPoolForiRule now has available members Nov 17 14:53:28 slb10mddcwi err tmm2[16157]: 01010221:3: Pool /Common/TestPoolForiRule now has available members Nov 17 14:53:28 slb10mddcwi err tmm3[16157]: 01010221:3: Pool /Common/TestPoolForiRule now has available members Nov 17 14:53:28 slb10mddcwi err tmm[16157]: 01010221:3: Pool /Common/TestPoolForiRule now has available members Nov 17 14:53:32 slb10mddcwi notice mcpd[6310]: 01071912:5: Virtual Address /Common/10.10.10.100 general status changed from RED to GREEN. Nov 17 14:53:32 slb10mddcwi notice mcpd[6310]: 01071913:5: Virtual Address /Common/10.10.10.100 monitor status changed from DOWN to UP.Could an iRule be used to trigger a tmsh command or something along those lines to accomplish this?
Thanks