spmedge_85938
Dec 29, 2011Nimbostratus
I am new to iRule
I want to have a iRule that say if a web server give a http 404 or 500 error the web server should be fore offline. How do I do this in F5?
LB::down wiki
http://devcentral.f5.com/wiki/iRules.LB__down.ashx
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve1023:Active] config b pool foo list
pool foo {
members 200.200.200.101:80 {}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_RESPONSE {
if {[HTTP::status] equals "200"} {
LB::down
}
}
}
[root@ve1023:Active] config b pool foo|grep -i pool\ member
+-> POOL MEMBER foo/200.200.200.101:80 active,unchecked
[root@ve1023:Active] config curl -i http://172.28.19.79
HTTP/1.1 200 OK
Date: Thu, 29 Dec 2011 16:03:37 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
ETag: "4183e4-3e-9c564780"
Accept-Ranges: bytes
Content-Length: 62
Content-Type: text/html; charset=UTF-8
This is 101 host.
[root@ve1023:Active] config tail -f /var/log/ltm
Dec 29 08:03:23 local/tmm err tmm[26866]: 01010028:3: No members available for pool foo
Dec 29 08:03:23 local/ve1023 err mcpd[25539]: 01070809:3: iRule has marked pool member 200.200.200.101:80 down, no monitor to mark up.
Dec 29 08:03:23 local/ve1023 notice mcpd[25539]: 01070638:5: Pool member 200.200.200.101:80 monitor status iRule down.
[root@ve1023:Active] config b pool foo|grep -i pool\ member
+-> POOL MEMBER foo/200.200.200.101:80 inactive,irule down