Forum Discussion

nanukanu_263047's avatar
nanukanu_263047
Icon for Nimbostratus rankNimbostratus
Nov 16, 2016

URL Probe

Hi,

 

I want to use a Monitor Health using http/s;

 

Let's supose I want to probe to "/testmonitor.aspx" (or whatever html, php...), and expect recieve a 200 status, how can I realize this, or more exaclty, how the regular expresion will be?

 

Regards!

 

5 Replies

  • See SOL13397

    An example:

    GET /testmonitor.aspx HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close\r\n

    You can use "200 OK" as the "Receive String" but I would recommend looking at some unique string within the content as "200 OK" is a bit generic and can show up within the content even if the response is different from expected.

  • Or instead of doing a standard GET-request you can use a HEAD-request, which returns just the header of the response. So the receive string must be part of the header.

    HEAD /testmonitor.aspx HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close\r\n
    

    Ciao Stefan 🙂

  • Ok.. so... it's necessary to add Host if i'm monitiring the same server? Let's supose I'm monitoring 2.2.2.2, in this case, its necessary write:

     

    • HEAD /testmonitor.aspx HTTP/1.1\r\nHost: 2.2.2.2\r\nConnection: Close\r\n

    or just can write;

     

    • HEAD /testmonitor.aspx HTTP/1.1\r\n

    Then, on Recieve String field: * I will put 200, or ^HTTP(.*)\s(200), o whatelse?

     

    Regards and many thanks for the support.

     

  • The difference between a HEAD- and a GET-request is to tell the server to respond just with the headers or with the whole content. All other parts of the request will be the same for both methods depending on the requirements of the server. So if the server requires the hostname (e.g. due to multiple virtual hosts) you must specify HTTP/1.1 and include the host-header. Specifying HTTP/1.1, but not including the host-header is not allowed. So you could try the following.

     

    Send-String: HEAD /testmonitor.aspx HTTP/1.0\r\nConnection: Close\r\n\r\n

     

    Receive-String: HTTP/1.1 200 OK

     

    If you have issues with your monitor getting green you can either sniffer the monitor traffic (in case it's unencrypted) or you make a telnet and send the above mentioned Send-String via CLI. Then you can check the response from the server and correct your settings accordingly.

     

    Ciao Stefan :)

     

  • What do you mean with "monitoring the same Server"? As I already mentioned, the host-header normally is only required if you are working with virtual hosts on your server or if the "listener" on your server requires explicit a host-header. Again, if you are unsure how your send-string should look like, please try it manually via CLI and verify how your server/application behaves.

     

    Regarding the regex for the receive string, please check this website with all official HTTP Status codes. As you can see the "OK" belongs explicit to the 200 code, means there isn't an official "300 OK". Further details on the correct syntax can be found in this solution.

     

    Ciao Stefan :)