Forum Discussion

SeanW_82915's avatar
SeanW_82915
Icon for Nimbostratus rankNimbostratus
Jun 23, 2009

HTTP Monitor and checking http headers

I'm monitoring several web servers and wanted to come up with a health monitor that just checks the HTTP response code. I needed two... One that accepts 200/301/302 and one that also accepts an authorization request. It took a bit of head scratching, a call to TAC, and a lot of experimentation, but if you do a standard HTTP test with:

 

 

Send String: GET / HTTP/1.0\r\nConnection: Close

 

Receive String: HTTP/1.. (301|200|302)

 

 

It works correctly.

 

 

For the one that also accepts a 401 the receive string becomes HTTP/1.. (301|200|302|401)

 

 

SOL3224 was somewhat misleading in that it tells you to look at the redirected page if you want to check this, but there's nothing saying the two are on the same server. With the above you can put the Location header in your receive string, or just look for the 301/302.

 

 

Sean

1 Reply

  • Hi Sean,

     

     

    Thanks for posting your solution. I don't think the Connection header was implemented in HTTP 1.0, so you might be better off using HTTP 1.1 for the request. HTTP 1.1 requires a Host header, but not a value for it. If you don't want to specify the host header value, you can leave it blank:

     

     

    GET / HTTP/1.1\r\nHost: \r\nConnection: Close\r\n

     

     

    Also, bigd, the monitoring daemon, will add one or two carriage return / line feeds to the end of the send string (varying by version). It's worth it to verify for your particular version, whether your configured send string ends up having two and only two CRLF's at the end on the actual requests made to the pool members.

     

     

    Aaron