Forum Discussion

adrianglendinning's avatar
adrianglendinning
Icon for Nimbostratus rankNimbostratus
Jul 04, 2024

F5 TCP Health Monitor Send/Receive strings

Hi 

We need to create TCP health checks on an LTM device that checks the health of a VIP running on an LTMi device. I'm not sure how the send and receive strings should look. Wondering if anyone would have an example similar to this.

Thanks

Adrian

3 Replies

  • send string is simple text but receive string is in regular expression format.
    https://techdocs.f5.com/en-us/bigip-16-0-0/big-ip-local-traffic-manager-monitors-reference/monitors-settings-reference.html#GUID-E9DF771F-EA09-4AA0-8834-5F35376B8C46
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search#examples

    if youre not familiar with programming, i suggest you ask help from app developer team.
    just like the industry name suggest, i.e. application delivery controller, bigip is actually very application layer so it's normal that application team is involved in the configuration.

  • Hi Adrian,

    Are you trying to monitor a VIP on F5? Why not monitor the pool members instead?

    Check out this article below for crafting strings for tcp monitors.

    https://my.f5.com/manage/s/article/K01524704

    In addition, most of the time the default tcp profile works perfectly except you're expecting a particular echo response from the servers.

  • Hello Adrian,

     

    If its L7 vip, go with http or https monitoring instead of TCP. That will be more recommended that usual port monitoring. if its a L4 vip, use below steps. i have added http monitoring details Aswell(receive and send).

    https://my.f5.com/manage/s/article/K01524704  

    Steps to Create TCP Health Checks:
    Log in to the LTM Device:

    Access the LTM device through the command line or GUI.
    Create a New TCP Health Monitor:

    If using the GUI, navigate to Local Traffic > Monitors > Create.
    If using the command line, you can use the tmsh command.
    Configure the Monitor Settings:

    Name: Assign a name to the monitor (e.g., TCP_Health_Check).
    Type: Select TCP.
    Send and Receive Strings:
    The send and receive strings will depend on the specific application protocol running on the VIP. Here are some common examples:

    Example for HTTP VIP:
    Send String:


    GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n
    This sends an HTTP GET request to the server.

    Receive String:

    HTTP/1.1 200 OK
    This expects the server to respond with a 200 OK status.

    Example for a Simple TCP Echo Server:
    Send String:


    HELLO
    This sends a simple string HELLO to the server.

    Receive String:


    HELLO
    This expects the server to echo back the same string HELLO.

    Example Configuration in tmsh:
    Here’s how you might configure a TCP health monitor with tmsh:

    sh

    tmsh create ltm monitor tcp TCP_Health_Check send "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n" recv "HTTP/1.1 200 OK"
    Applying the Monitor to a Pool:
    After creating the monitor, you need to assign it to the relevant pool:

    sh

    tmsh modify ltm pool my_pool monitors add { TCP_Health_Check }
    Verifying the Configuration:
    To ensure your monitor is working correctly, you can check the status:

    sh

    tmsh show ltm pool my_pool
    This will show the status of the pool members and whether they are marked up or down based on the health checks.