Forum Discussion
Irule bassed on html
Hi, i have a monitor string that look into serveralive.html, if he recieve 1 than he send the request to the server on the pool, so if i want to do some working on the server all connection will go to another one on the pool by changing the serveralive.html value to 0 . what i want to do is an irule that will let me move traffic to that pool even if my both serveralive.html file will send 0, can i do it?
thats how i will get full pritection for my mistakes :)
16 Replies
- hoolio
Cirrostratus
Hi Alakata,
You could do this with a custom external monitor. But it's going to add extra overhead on LTM for a situation that you could probably prevent through operating procedures.
You can create a shell script to add the logic for marking a pool member down only if it's not the last member up using this template:
http://devcentral.f5.com/wiki/default.aspx/AdvDesignConfig/TemplateForExternalLtmMonitors.html
You can check the number of active members in the pool using bigpipe or tmsh:
b pool MY_POOL | grep -c 'active,up'
And then return UP in the script if the number of active,up members is 1.
Aaron - alakata_2951
Nimbostratus
Hi Aaron
first thanks for the fast reply!
i am a newbi in all that scripting thing (sorry about that)
i guess you have to start in order to know this stuff :)
for my understanding-
1) i have a pool with 2 members, so if i monitor the html for that 1 value, the f5 looking for that header in the first server and then in the second and so on?
2)if change the value on any of the member i shuold see the member down right?
3) why cant i use an irule that will look for that value and use a else command to redirect the connection to a secondry pool with the same member? - Minn_62043
Cirrostratus
You can use iRule to select a pool member based on the certain condition.http://devcentral.f5.com/wiki/default.aspx/iRules/pool.html - hoolio
Cirrostratus
I think I misunderstood what you were trying to do. I think you could do something like what you've described using an iRule which checks if the virtual server's default pool has no active members and selects a secondary pool in that case.when CLIENT_ACCEPTED { Save the name of the virtual server's default pool before it is potentially changed by this iRule set default_pool [LB::server pool] } when HTTP_REQUEST { Check if the virtual server pool is down if {[active_members $default_pool] == 0 }{ Select an alternate pool pool second_pool } }
Aaron - alakata_2951
Nimbostratus
well thanks, i guess that this is what i was after :)
can you plz help me with the string too:
GET /serverAlive.html HTTP/1.1\r\nHost:x.x.x.il\r\nConnection: Close (instead of x.x.x is the subdomain)
and the Receive String is: 1
when i change the serverAlive.html to "0" i don't see any member as DOWN- they all still up.
root@f5:Active] log tail -F ltm
Jun 22 10:08:20 f5 mcpd[1919]: 01070727:5: Pool member 172.16.1.11:80 monitor status up.
Jun 22 10:08:20 f5 mcpd[1919]: 01070727:5: Pool member 172.16.1.12:80 monitor status up.
watch -n1 "b pool SRV-Pool90 | grep -c 'active,up'" - show me that all the members are UP
do you have any idea why..? - hoolio
Cirrostratus
I think you need something more specific than just "1" to look for in the response. It's quite likely that "1" would be found in the response headers. Can you use curl to check the response from the server when the value is 0 and 1 and post the anonymous output here?
curl -v http://172.16.1.11/serverAlive.html
Aaron - alakata_2951
Nimbostratus
i will,
just have to say that the html file contain only 1 or 0 that's it
but i will connect to the machine and post it
thanks... - hoolio
Cirrostratus
Every HTTP response will have a 1 in the headers:
$ curl -I www.google.com
HTTP/1.1 200 OK
Date: Thu, 23 Jun 2011 04:33:00 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=f8f9f9434837e153:FF=0:TM=1308803580:LM=1308803580:S=1qZtUoTJvrkU4_zY; expires=Sat, 22-Jun-2013 04:33:00 GMT; path=/; domain=.google.com
Server: gws
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
Can you try a receive string of:
\n1\n
Aaron - alakata_2951
Nimbostratus
I guess I will try it but can you please tell me what do you mean
/n1/n
I hope it's o.k to ask :)
Maybe I will use specific word? - hoolio
Cirrostratus
Actually, can you try this:
\n1$
\n is a newline character. 1 is the literal character. And $ means that the preceding substring must be found at the end of the string.
So if your page returns a payload of just 1, then you could look for a newline and 1 at the end of the string.
Aaron
Recent Discussions
Related Content
* 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
