Forum Discussion

Moinul_Rony's avatar
Moinul_Rony
Icon for Altostratus rankAltostratus
Dec 09, 2013

Monitor tomcat availability using iRule

Hi,

 

We want to create a iRule or Monitor to check the tomcat/JSP availabilty on the application pool members and disable a pool member if JSP is not rendering properly or tomcat is down.

 

Can this be done from Pool load balance settings or via an iRule on the virtual server?

 

Please help.

 

3 Replies

  • Of course!! Have you looked up the documentation for monitors on your version of LTM?

     

    Best practice is to check the Receive String for some specific content (not just HTTP status code).

     

    Here's a simple v10 HTTP/1.0 example we use in our Tomcat containers;-

     

    monitor mn_bpweb_mode.jsp {
        defaults from http
        recv disable "transition"
        recv "normal"
        send "GET /platform/mode.jsp\r\n\r\n"
    }

    We use that jsp file to take servers in/out of the pool - it gets deployed with the Tomcat packages.

     

    Here's another example we use for another application just to show you a more complicated send string;-

     

    monitor mn_mcms_author.mycms.com.au_http {
        defaults from http
        recv "Alive"
        send "GET /libs/granite/core/content/login/clientlib/healthcheck.html?a=b HTTP/1.1\r\nHost: author.mycms.com.au\r\nConnection: close\r\n\r\n"
    }
    • Moinul_Rony's avatar
      Moinul_Rony
      Icon for Altostratus rankAltostratus
      Thanks for the prompt reply.. How do I go about taking the servers in/out of the pool? Can this be managed in such a way that it doesn't mark the whole pool offline ? I am trying to figure how we can relate this monitor to a irule to manage the affected nodes.
  • Hi, So the example I gave was for a monitor, so you would have to alter the /platform/mode.jsp (for example) on the server you wished to remove from the pool, so that it doesn't return "normal" any more.

     

    I only answered part of your question however as you had previously mentioned iRules. You can momentarily mark a server down using LB::down, however the next monitor execution will bring it back up, and if you are running a version prior to 11.4 there is no supported way of bridging TMM (iRules) and the management plane (configuration), although you could have an external process that could monitor log messages generated by an iRule and then use iControl to remove members from a pool, but it's definitely a bespoke configuration that you would have to develop/support yourself.

     

    If you have v11.4 or greater you can use iCall which is their newish all-singing/dancing feature that lets you alter configuration from an iRule. I haven't used it yet but here is some doco;-

     

    https://devcentral.f5.com/articles/icall-all-new-event-based-automation-system.UtXwtEq4aM8

     

    https://devcentral.f5.com/wiki/iCall.Mark_Server_Down_on_Excessive_Errors.ashx