Forum Discussion

vshiva's avatar
vshiva
Icon for Nimbostratus rankNimbostratus
Aug 16, 2021

Configure a monitor/irule to check a webpage health only after login using a test credentials

I am looking for help to configure a monitor/irule to login to a web page with credentials then check the service up/down when the login is successful. It would be really appreciated if someone could be able to share/help me with coding/programming to achieve this.

 

I have gone through some F5 articles but did not find a better solution.

  • Finally, I did it! Staging, UA, DEV environment pools are running currently using this custom health monitor and I have been implementing this in the production environment without any issues.

    Configuration:

    Create new health monitor with the following settings:

    From the F5 GUI:

    Send string: POST /Account/SignIn HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close\r\nContent-Length:10\r\nAuthorization: Basic ZjU6ZjVwYXNzd2Q=\r\n\r\0123456789

    Receive string: 302 Found

    Interval: 10 seconds (use whichever is acceptable)

    Timeout: 31 seconds (use whichever is acceptable)

    Since we need the monitor to login to the website with the credentials we provide, do the following:

    To generate the encrypted auth string like in the send string above:

    1. Log in to the BIG-IP command line.
    2. Generate an encrypted auth string by using the following syntax:

      echo -n 'username:password' | base64

      For example, if you used the user name f5 and the password f5passwd, the output would appear as follows:

      ZjU6ZjVwYXNzd2Q=

    To test the monitor before applying it to the corresponding pool on F5, you can test using the below commands:

    From F5 CLI:

    tmsh

    run /ltm monitor http <health monitor name> destination <dest_ip>
    show /ltm monitor http <health monitor name> test-result

     

    Happy learning!

  • vshiva's avatar
    vshiva
    Icon for Nimbostratus rankNimbostratus

    Finally, I did it! Staging, UA, DEV environment pools are running currently using this custom health monitor and I have been implementing this in the production environment without any issues.

    Configuration:

    Create new health monitor with the following settings:

    From the F5 GUI:

    Send string: POST /Account/SignIn HTTP/1.1\r\nHost: host.domain.com\r\nConnection: Close\r\nContent-Length:10\r\nAuthorization: Basic ZjU6ZjVwYXNzd2Q=\r\n\r\0123456789

    Receive string: 302 Found

    Interval: 10 seconds (use whichever is acceptable)

    Timeout: 31 seconds (use whichever is acceptable)

    Since we need the monitor to login to the website with the credentials we provide, do the following:

    To generate the encrypted auth string like in the send string above:

    1. Log in to the BIG-IP command line.
    2. Generate an encrypted auth string by using the following syntax:

      echo -n 'username:password' | base64

      For example, if you used the user name f5 and the password f5passwd, the output would appear as follows:

      ZjU6ZjVwYXNzd2Q=

    To test the monitor before applying it to the corresponding pool on F5, you can test using the below commands:

    From F5 CLI:

    tmsh

    run /ltm monitor http <health monitor name> destination <dest_ip>
    show /ltm monitor http <health monitor name> test-result

     

    Happy learning!

  • Hello vshiva.

     

    External monitors are what you were looking for

    REF - https://support.f5.com/csp/article/K31435017

    REF - https://devcentral.f5.com/s/articles/External-Monitor-Information-and-Templates

    REF - https://devcentral.f5.com/s/articles/ltm-external-monitors-the-basics

     

    Regards,

    Dario.