URL monitoring problem

2 different web servers have to be monitored by LTM with version 10.2.0.

1 is 10.10.1.32 with monitoring URL http://10.10.1.32/Web/status.htm. It returns “Running” and I turn on debug with following messages.

2011-06-16 17:01:09.458329: ID 23 :(_send_active_service_ping): writing [ addr=::ffff:10.10.1.32:80 srcaddr=::ffff:10.10.1.7:54665 ] send=GET /Web/status.htm HTTP/1.1\x0d\x0aHost: 10.10.1.32\x0d\x0aConnection: Close\x0d\x0a\x0d\x0a

2011-06-16 17:01:09.458436: ID 23 :(_send_active_service_ping): sent ping [ addr=::ffff:10.10.1.32:80 srcaddr=::ffff:10.10.1.7:54665 ]

2011-06-16 17:01:09.458527: ID global:(_main_loop): about to select for 0.100000s

2011-06-16 17:01:09.458986: ID 23 :(_main_loop): rfd selected [ addr=::ffff:10.10.1.32:80 srcaddr=::ffff:10.10.1.7:54665 fd=9 pend=0 ]

2011-06-16 17:01:09.459065: ID 23 :(_recv_active_service_ping): reading [ addr=::ffff:10.10.1.32:80 srcaddr=::ffff:10.10.1.7:54665 ]

2011-06-16 17:01:09.459163: ID 23 :(_recv_active_service_ping): rcvd 304 bytes: -->HTTP/1.1 200 OK\x0d\x0aContent-Type: text/html\x0d\x0aLast-Modified: Tue, 14 Jun 2011 08:06:52 GMT\x0d\x0aAccept-Ranges: bytes\x0d\x0aETag: “036a946a2acc1:0”\x0d\x0aServer: Microsoft-IIS/7.5\x0d\x0aX-Powered-By: ASP.NET\x0d\x0aDate: Thu, 16 Jun 2011 09:06:15 GMT\x0d\x0aConnection: close\x0d\x0aContent-Length: 41\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0aRunning\x0d\x0a\x0d\x0a<-- [ addr=::ffff:10.10.1.32:80 srcaddr=::ffff:10.10.1.7:54665 ]

2011-06-16 17:01:09.459257: ID 23 :(_recv_active_service_ping): Response matched regex [ addr=::ffff:10.10.1.32:80 srcaddr=::ffff:10.10.1.7:54665 ] send=GET /Web/status.htm HTTP/1.1\x0d\x0aHost: 10.10.1.32\x0d\x0aConnection: Close\x0d\x0a\x0d\x0a

recv=Running

disable=

monitor configuration:

monitor monitor_10.10.1.32_1 {

defaults from http

recv “Running”

send "GET /Web/status.htm HTTP/1.1\r\nHost: 10.10.1.32\r\nConnection: Cl

ose\r\n\r\n"

}

Actually this monitor works find.

However I have another similar monitor which does not work properly. 10.10.1.12 with monitoring URL http://10.10.1.12/health/health.aspx. It returns “OK” and my monitor is configured to match “OK”. When the server returns “NOTOK” on purpose, the monitor still deem the response as matched, with following debug message.

2011-06-16 17:01:07.455238: ID 11 :(_send_active_service_ping): writing [ addr=::ffff:10.10.1.12:80 srcaddr=::ffff:10.10.1.7:34974 ] send=GET /health/health.aspx HTTP/1.1\x0d\x0aHost: 10.10.1.12\x0d\x0aConnection: Close\x0d\x0a\x0d\x0a

2011-06-16 17:01:07.455344: ID 11 :(_send_active_service_ping): sent ping [ addr=::ffff:10.10.1.12:80 srcaddr=::ffff:10.10.1.7:34974 ]

2011-06-16 17:01:07.455465: ID global:(_main_loop): about to select for 0.100000s

2011-06-16 17:01:07.457013: ID 11 :(_main_loop): rfd selected [ addr=::ffff:10.10.1.12:80 srcaddr=::ffff:10.10.1.7:34974 fd=9 pend=0 ]

2011-06-16 17:01:07.457131: ID 11 :(_recv_active_service_ping): reading [ addr=::ffff:10.10.1.12:80 srcaddr=::ffff:10.10.1.7:34974 ]

2011-06-16 17:01:07.457223: ID 11 :(_recv_active_service_ping): rcvd 277 bytes: -->HTTP/1.1 200 OK\x0d\x0aCache-Control: private\x0d\x0aContent-Type: text/html; charset=utf-8\x0d\x0aServer: Microsoft-IIS/7.5\x0d\x0aX-AspNet-Version: 2.0.50727\x0d\x0aX-Powered-By: ASP.NET\x0d\x0aDate: Thu, 16 Jun 2011 09:06:14 GMT\x0d\x0aConnection: close\x0d\x0aContent-Length: 39\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0aNOTOK\x0d\x0a\x0d\x0a<-- [ addr=::ffff:10.10.1.12:80 srcaddr=::ffff:10.10.1.7:34974 ]

2011-06-16 17:01:07.457316: ID 11 :(_recv_active_service_ping): Response matched regex [ addr=::ffff:10.10.1.12:80 srcaddr=::ffff:10.10.1.7:34974 ] send=GET /health/health.aspx HTTP/1.1\x0d\x0aHost: 10.10.1.12\x0d\x0aConnection: Close\x0d\x0a\x0d\x0a

recv=OK

disable=

monitor configuration:

monitor monitor_10.10.1.12_1 {

defaults from http

recv “OK”

send "GET /health/health.aspx HTTP/1.1\r\nHost: 10.10.1.12\r\nConnection: Clo

se\r\n\r\n"

}

Could someone shield some light on this? Many thanks!

Daniel

Hi Daniel,

The problem is that the receive string of OK is being matched even when the server returns NOTOK. Can you try this regex in the receive field (removing all of the spaces)?

( ? < ! N O T ) O K

It should match OK only if it’s not preceded by NOT.

$ cat test.html

this line only contains OK so it should match

this line contains NOTOK so it should not match

$ grep -P ‘( ? < ! N O T ) O K’ test.html

this line only contains OK so it should match

Aaron

Thanks for your prompt reply. However I got this error message during configuration (I removed all spaces)

01070753:3: Monitor monitor_10.51.1.12_1 recv parameter contains an invalid regular expression (Invalid preceding regular expression).

I am sorry that I don’t know much about regular expression.

Hi hoolio,

From your reply I think what I need is a regex of matching only the “OK” string. I will try to figure it out. Many thanks!

Actually, it looks like you can’t use a negative lookbehind in a monitor receive string. There are a few other options:

use a receive string of \r\nOK

change the app to return a unique string like DOWN instead of NOTOK

Aaron

Hi hoolio,

I tried “^OK$” which I assume is the exact match of the string “OK”. But then the member is marked down. Is the regex wrong?

would u mind trying this?

(.*)^ok

sol5917: Using regular expressions in a health monitor receive string

http://support.f5.com/kb/en-us/solu…l5917.html

Hi nitass,

Your suggestion works for all string that starts with “OK”, e.g. OKOK

How can I make it only to match “OK”?

Were you able to try a receive string of:

\r\nOK

If that doesn’t work, can you try:

\x0d\x0aOK

sol4186: Entering escape sequences in an ECV health monitor’s send and receive strings

Aaron

Hi Aaron,

Both of them do not work. The member is marked as down. However as I am at home now so I can only test it with VE which is 10.1.0. Not sure if that matters.

i think i know what is wrong. ok is also in http header i.e. http status code

curl -i http://10.10.70.110/monitor1.html

HTTP/1.1 200 OK

Date: Fri, 17 Jun 2011 19:29:21 GMT

Server: Apache/2.0.59 (rPath)

Last-Modified: Fri, 17 Jun 2011 19:21:47 GMT

ETag: “6696-4-4bf4a8c0”

Accept-Ranges: bytes

Content-Length: 4

Vary: Accept-Encoding

Content-Type: text/html; charset=UTF-8

ABC

curl -i http://10.10.70.110/monitor2.html

HTTP/1.1 200 OK

Date: Fri, 17 Jun 2011 19:29:32 GMT

Server: Apache/2.0.59 (rPath)

Last-Modified: Fri, 17 Jun 2011 19:22:41 GMT

ETag: “6693-7-4f2ca240”

Accept-Ranges: bytes

Content-Length: 7

Vary: Accept-Encoding

Content-Type: text/html; charset=UTF-8

NOTABC

curl -i http://10.10.70.110/monitor3.html

HTTP/1.1 200 OK

Date: Fri, 17 Jun 2011 19:29:47 GMT

Server: Apache/2.0.59 (rPath)

Last-Modified: Fri, 17 Jun 2011 19:22:51 GMT

ETag: “65bb-7-4fc538c0”

Accept-Ranges: bytes

Content-Length: 7

Vary: Accept-Encoding

Content-Type: text/html; charset=UTF-8

ABCABC

[root@tulip:Active] config b monitor myhttp list

monitor myhttp {

defaults from http

interval 2

timeout 7

recv “(.*)^abc\n”

send “GET /monitor1.html HTTP/1.1\r\nHost: \r\nConnection: Close\r\n\r\n”

}

[root@tulip:Active] config b pool pooh list

pool pooh {

monitor all myhttp

members 10.10.70.110:http {}

}

[root@tulip:Active] config b pool pooh

POOL pooh LB METHOD round robin MIN/CUR ACTIVE MEMBERS 0/1

| (cur, max, limit, tot) = (0, 0, 0, 0)

| (pkts,bits) in = (0, 0), out = (0, 0)

±> POOL MEMBER pooh/10.10.70.110:http active,up

| session enabled priority 0 ratio 1

| (cur, max, limit, tot) = (0, 0, 0, 0)

| (pkts,bits) in = (0, 0), out = (0, 0)

| requests (total) = 0

[root@tulip:Active] config b monitor myhttp list

monitor myhttp {

defaults from http

interval 2

timeout 7

recv “(.*)^abc\n”

send “GET /monitor2.html HTTP/1.1\r\nHost: \r\nConnection: Close\r\n\r\n”

}

[root@tulip:Active] config b pool pooh

POOL pooh LB METHOD round robin MIN/CUR ACTIVE MEMBERS 0/0

| (cur, max, limit, tot) = (0, 0, 0, 0)

| (pkts,bits) in = (0, 0), out = (0, 0)

±> POOL MEMBER pooh/10.10.70.110:http inactive,down

| session enabled priority 0 ratio 1

| (cur, max, limit, tot) = (0, 0, 0, 0)

| (pkts,bits) in = (0, 0), out = (0, 0)

| requests (total) = 0

[root@tulip:Active] config b monitor myhttp list

monitor myhttp {

defaults from http

interval 2

timeout 7

recv “(.*)^abc\n”

send “GET /monitor3.html HTTP/1.1\r\nHost: \r\nConnection: Close\r\n\r\n”

}

[root@tulip:Active] config b pool pooh

POOL pooh LB METHOD round robin MIN/CUR ACTIVE MEMBERS 0/0

| (cur, max, limit, tot) = (0, 0, 0, 0)

| (pkts,bits) in = (0, 0), out = (0, 0)

±> POOL MEMBER pooh/10.10.70.110:http inactive,down

| session enabled priority 0 ratio 1

| (cur, max, limit, tot) = (0, 0, 0, 0)

| (pkts,bits) in = (0, 0), out = (0, 0)

| requests (total) = 0

Nice catch, Nitass.. Just found this SOL3618:

Nice work in catching that Nitass. But I’d still expect \r\nOK to work only when the pool member returns OK as part of the payload as the 200 OK isn’t an OK following a CR LF.

Odd…

Aaron