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

Have you considered using a monitor with a receive disable string or just using the REST api to take the pool member offline?

Have you considered using a monitor with a receive disable string or just using the REST api to take the pool member offline?

I wouldn’t really know how to do that. Do you have an example of one?

Here’s a good explanation of a receive disable string. 404 Page not found | BIG-IP Documentation

Here’s a good explanation of a receive disable string. 404 Page not found | BIG-IP Documentation

I’m open to all options. I’m just trying to take a little workload off of my team.

I’m open to all options. I’m just trying to take a little workload off of my team.

That might work. Do you have an example of using the REST api to do it too?

That might work. Do you have an example of using the REST api to do it too?

The API is a bit more involved of a solution, but it is a frame work to edit just about everything on the BigIP via a REST API. F5 Cloud Docs This would be an example to disable a pool member. curl -sk -u ‘admin:admin’ -H “Content-Type: application/json” -X PUT https://192.168.1.246/mgmt/tm/ltm/pool/~Common~Pool1/members/~Common~10.0.0.1:80 ‘{“session”: “user-disabled”}’

The API is a bit more involved of a solution, but it is a frame work to edit just about everything on the BigIP via a REST API. DevCentral - An F5 Technical Community This would be an example to disable a pool member. curl -sk -u ‘admin:admin’ -H “Content-Type: application/json” -X PUT https://192.168.1.246/mgmt/tm/ltm/pool/~Common~Pool1/members/~Common~10.0.0.1:80 ‘{“session”: “user-disabled”}’

Brad thats nice code. I’ll use that :slight_smile:

Brad thats nice code. I’ll use that :slight_smile: