cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3419
Views
0
Helpful
7
Replies

HTTP probe issue with expect regex string

stevens_jj
Level 1
Level 1

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?

7 Replies 7

Kristopher Martinez
Cisco Employee
Cisco Employee

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.

http://www.cisco.com/en/US/docs/interfaces_modules/services_modules/ace/vA4_1_0/configuration/slb/guide/probe.html#wp1031557

Regards

Kris

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.

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">

  Probe

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

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)

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

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.

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: