09-27-2011 11:10 AM
Hello,
We have a simple cgi status page setup to poll a background service and return a "PASS" or "FAIL" as output. I've setup an HTTP probe to look for the "PASS" to determine application health. The issue appears to be that the expect regex is searching the HEADER but not the BODY of the web page. I can successfully match on any string in the header, but never on anything in the body.
Here is what the web page returns if you telnet to it:
HTTP/1.1 200 OK
Date: Thu, 22 Sep 2011 22:45:07 GMT
Server: Apache/2.0.59 HP-UX_Apache-based_Web_Server (Unix) DAV/2
Content-Length: 4
Connection: close
Content-Type: text/plain; charset=iso-8859-1
PASS
Here is my probe:
probe http JOE-TEST-CS
interval 45
passdetect interval 30
receive 30
request method get url /cgi-bin/ERMS-PREP-statusRepo.cgi
expect status 0 999
open 20
expect regex "PASS"
Here is the output of the show probe:
ACE1/euhr-test-ace2# sh probe JOE-TEST-CS detail
probe : JOE-TEST-CS
type : HTTP
state : ACTIVE
description :
----------------------------------------------
port : 80 address : 0.0.0.0 addr type : -
interval : 45 pass intvl : 30 pass count : 3
fail count: 3 recv timeout: 30
http method : GET
http url : /cgi-bin/ERMS-PREP-statusRepo.cgi
conn termination : GRACEFUL
expect offset : 0 , open timeout : 20
expect regex : PASS
send data : -
--------------------- probe results --------------------
probe association probed-address probes failed passed health
------------------- ---------------+----------+----------+----------+-------
serverfarm : JOE-TEST-PROBE-CS
real : EUHRTDM50.APP[0]
192.168.73.71 2 2 0 FAILED
Socket state : CLOSED
No. Passed states : 0 No. Failed states : 1
No. Probes skipped : 0 Last status code : 200
No. Out of Sockets : 0 No. Internal error: 0
Last disconnect err : User defined Reg-Exp was not found in Host Response
Last probe time : Thu Sep 22 15:00:36 2011
Last fail time : Thu Sep 22 15:00:36 2011
Last active time : Thu Sep 22 09:40:19 2011
If I replace the expect regex "PASS" with anything from the HEADER it succeeds!
Any thoughts?
09-27-2011 11:23 AM
Joseph,
Does the server response contain the "content-length" header? This is required for expect regex and hash to function.
If this is a static page besides the PASS/FAIL variable, you could configure the ACE to hash the page. The ACE will generate a hash value of the page and if that hash value changes, the ACE will consider the probe failed.
Regards
Kris
09-27-2011 12:18 PM
If you look at the first part of my post - the "Content-Length: 4" header is in the header. I've tried the hash, but the same problem makes this bad as well since it is only hashing the header and NOT the body.
09-27-2011 01:21 PM
Sorry, I missed it. The content-length in your request is 4. I think this may be the issue. I created a basic HTML page that says PASS in the body and my server is returning a content-length of 224 when I fetch the page. Here is my HTML request:
GET /index.html
http-equiv="Content-Type">
PASS
Here are my headers that I received:
(Status-Line) HTTP/1.1 200 OK
Content-Length 224
Content-Type text/html
Last-Modified Tue, 27 Sep 2011 12:05:00 GMT
Accept-Ranges bytes
Etag "8cca60aed7dcc1:41f"
Server Microsoft-IIS/6.0
Date Tue, 27 Sep 2011 12:25:59 GMT
What version of code are you running on your ACE? I can also look to see if there are any known issues.
Kris
09-27-2011 02:09 PM
I'm not really sure what the Content-Length is supposed to be set at. I've done a ton of searching and its something like the number of octets of the body, which means nothing to me. I tried setting it to 224 like you have, but still fails.
I've even set it to 1024 and it still fails to find anything in the body. It still finds HEADER strings perfectly. Its as though it sees the header as the body.
Ace ver A2(3.4)
09-28-2011 06:30 AM
Hi Joseph,
Can you get sniffer traces from the server while the ACE is probing it? When you mentioned that you are telneting to the server, were you GETting /cgi-bin/ERMS-PREP-statusRepo.cgi to get the HTTP200 Ok message you provided?
Best regards,
Ahmad
09-28-2011 09:00 AM
I did the following to capture the output:
telnet server 80
GET /cgi-bin/ERMS-PREP-statusRepo.cgi HTTP/1.0
I'll grab a packet capture right now.
09-28-2011 11:42 AM
I think we figured it out.
Had to do with a Cached response coming from Apache. Looks like by adding the client header Cache-Control: max-age=0, it forces Apache to send the new response every time.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide