Forum Discussion

Malcolm_Salmon1's avatar
Malcolm_Salmon1
Icon for Nimbostratus rankNimbostratus
Jun 10, 2014

Reverse Monitor Syntax to match Status Code 500-509

Hi

 

I'm trying to use a reverse monitor to mark any servers in a pool down that return a status code of 500-509. I'm unable to get this to work and I'm hoping someone will be able to help me. Currently I'm trying to match the following:

 

< HTTP/1.1 503 Service Unavailable

 

I'm using the following Receive String:

 

HTTP\/1.[01]\s50[0-9]

 

But this doesnt seem to match the above status code. Therefore if anybody could help me with this is would be greatly appreciated.

 

Thanks

 

Malc

 

3 Replies

  • sol5917: Using regular expressions in a health monitor Receive String

    http://support.f5.com/kb/en-us/solutions/public/5000/900/sol5917.html

    e.g.

     config
    
    [root@ve11a:Active:In Sync] config  tmsh list ltm monitor http myhttp
    ltm monitor http myhttp {
        defaults-from http
        destination *:*
        interval 5
        ip-dscp 0
        recv HTTP/1\.[01]\s40[0-9]
        reverse enabled
        send "GET /fake.html HTTP/1.1\r\nHost: \r\nConnection: Close\r\n\r\n"
        time-until-up 0
        timeout 16
    }
    
     test
    
    [root@ve11a:Active:In Sync] config  tmsh list ltm pool foo
    ltm pool foo {
        members {
            200.200.200.101:80 {
                address 200.200.200.101
                session monitor-enabled
                state down
            }
        }
        monitor myhttp
    }
    
     trace
    
    [root@ve11a:Active:In Sync] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 200.200.200.11(39804) <-> 200.200.200.101(80)
    1402421687.8100 (0.0248)  C>S
    ---------------------------------------------------------------
    GET /fake.html HTTP/1.1
    Host:
    Connection: Close
    
    ---------------------------------------------------------------
    
    1402421688.4348 (0.6247)  S>C
    ---------------------------------------------------------------
    HTTP/1.1 404 Not Found
    Date: Tue, 10 Jun 2014 17:23:53 GMT
    Server: Apache/2.2.3 (CentOS)
    Content-Length: 272
    Connection: close
    Content-Type: text/html; charset=iso-8859-1
    
    ...snipped...
    ---------------------------------------------------------------
    
  • Hi

     

    THanks for the responses. I actually decided to swap this round and look for positive responses in the ranges 200-400 instead of 500 for a negative response. I managed to get this working using the following:

     

    Send string:

     

    HEAD / HTTP/1.0\r\n\r\n

     

    Receive string:

     

    HTTP/1.[01] ([234]0[0-9])

     

    Thanks

     

    Malc