Forum Discussion

RobS's avatar
RobS
Icon for Altostratus rankAltostratus
Dec 28, 2012

Custom HTTP monitor that checks for existence of an image

In looking through DevCentral and AskF5 I haven't found the exact scenario I am in. We have a brand new pair of 3900's running 11.2.1 and we are only doing basic load balancing for a new Blackboard environment at this time. There are 2 BB web servers which pull all their content from a BB db server. I want a reliable http monitor that checks for content coming from the db server to validate everything is working. Based off of the documentation I located I built the following:

 

Send String: GET /branding/_1_1/logo_uchc.gif HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close\r\n\r\

 

Receive String: HTTP/1.1 200 OK

 

This seems to work okay and if I change the send or receive string to a nonexistent value the monitor marks it as down. The gif file is actually on the db server. My question is if this is an acceptable way to do this and also is host.domain.com in the send string supposed to be changed to a real value or does it stay the way it is (it is working as is)?

 

I appreciate any input!

 

Thanks,

 

Rob

 

10 Replies

  • I'd say you've taken a good approach. I'm not sure you actually need the Host or Connection parts myself and you may be making things overly complex with that. I'd try without and lose those if they are not required.
  • RobS's avatar
    RobS
    Icon for Altostratus rankAltostratus

    Hi Steve,

     

    Thanks for your reply. I also was wondering if I had more in there than I needed. I have this monitor applied to a test pool of servers so the good thing is I'm able to alter it on the fly and see the results. I tried a couple of variations including: GET /branding/_1_1/logo_uchc.gif HTTP/1.1\r\n\r\n\ and GET /branding/_1_1/logo_uchc.gif HTTP/1.1\r\nConnection: Close\r\n\r\n but the monitor then fails in both cases. I'm thinking I might just need to leave it the way it is since I don't fully grasp the syntax.

     

    Rob

     

  • I would have thought GET /branding/_1_1/logo_uchc.gif HTTP/1.1\r\n would have been enough. You should be able to test what works by telnetting to the server:port from the device and manually inputting the request string. The only thing that might be different between that and the real monitor is the \r\n, v10 adds it automatically, v9 and v11 don't I believe.
  • RobS's avatar
    RobS
    Icon for Altostratus rankAltostratus

    It looks like going directly against the server, it will only accept: GET /branding/_1_1/logo_uchc.gif

     

    Everything elese comes back with "HTTP Error 400. The request hostname is invalid." or " HTTP Error 400. The request is badly formed.".

     

    Thanks,

     

    Rob

     

  • OK, so your monitor could probably reflect that? The only thing I'm not sure of is whether you need the \r\n?
  • RobS's avatar
    RobS
    Icon for Altostratus rankAltostratus

    So after a little more testing, it seems to be happy with: GET /branding/_1_1/logo_uchc.gif HTTP/1.0 \r\n\r\n

     

    The server directly responds to: GET /branding/_1_1/logo_uchc.gif HTTP/1.0 so I think HTTP/1.1 was the issue even though it appeared to work through the LTM.

     

    Thanks for the help Steve!

     

    Rob

     

  • Hi Rob,

     

     

    Of course LTM supports HTTP1.1 and if your server supports it, why no to use it - even for the monitor. Based on your info, you did two mistakes when testing/configuring the monitors:

     

     

    1. MONITOR SYNTAX

     

    - The original monitor was correct and, as you said, it was working (GET /branding/_1_1/logo_uchc.gif HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close\r\n\r\n)

     

    - The other two variations were missing the HOST header, which is mandatory for HTTP1.1 protocol thus they didn't work as the server was expecting the host header in HTTP requests

     

    - The value of the host is not significant unless the server expects specific host value or it's configured to return different content based on the host values; You can use virtual domain name, IP address or the real server name; I believe 'blank' value or space might also work, but I'm not 100% sure

     

    - The 'Connection: Close' header is not mandatory, but it's good to use it so you don't have too many opened TCP connections to the server if your monitor sends the health checks too often

     

     

    The following two SEND strings should both work for you:

     

     

    GET /branding/_1_1/logo_uchc.gif HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close\r\n\r\n

     

    GET /branding/_1_1/logo_uchc.gif HTTP/1.1\r\nHost: host.domain.com\r\n\r\n

     

     

    2. TELNET TEST

     

    - Note that when trying to get to the server directly by telnet and then typing the GET request is different from the send strings specified in the LTM monitor:

     

    - \r\n sequence is represented by hitting the ENTER key in the CLI, so if you want to test exactly the same string specified in the LTM monitor from the CLI, you need to separate each request line or header with the enter key; LAST line must be followed by blank line, which is DOUBLE ENTER in CLI or \r\n\r\n sequence in the LTM monitor:

     

     

    telnet {server_name} 80{ENTER}

     

    GET /branding/_1_1/logo_uchc.gif HTTP/1.1{ENTER}

     

    Host: host.domain.com{ENTER}

     

    {ENTER}

     

     

    or

     

     

    telnet {server_name} 80{ENTER}

     

    GET /branding/_1_1/logo_uchc.gif HTTP/1.1{ENTER}

     

    Host: host.domain.com{ENTER}

     

    Connection: Close{ENTER}

     

    {ENTER}

     

     

  • RobS's avatar
    RobS
    Icon for Altostratus rankAltostratus

    Peter,

     

    Thanks so much for chiming in and explaining the syntax! Both telnet examples you provided returned the image file and I'll be changing my monitor back to what I had originally. Thanks again!

     

    Rob