iRule Pool member(s) offline or disabled

Hello community,

is there any way to check if the pool members offline/down (e.q. network or server error) or disabled (by a monitor during a maintenance) using a iRule?

The background would be the delivery of an event-specific user information page.

Network or server error => Error Page with Helpdesk-Support infos

Maintenance => simply maintenance site

Thanks & BR

René

You could use something like this

when HTTP_REQUEST {
   if { {[active_members poolName] < 1} } {
    HTTP::respond 200 content {
      <html>
         <head>
            <title>Apology Page</title>
         </head>
         <body>
            We are sorry, but the site you are looking for is temporarily out of service<br>
            If you feel you have reached this page in error, please try again.
         </body>
      </html>
   }
  }
}

for more flexibility you could also use iFiles

Hello,

thanks for the answer. But that’s don’t solve the problem. Funktion “active_members” can’t differentiate to pool state offline or disabled.

I don’t want to display just one maintenance message, but two different ones (depending on the pool status). I have no idea if that’s even possible.

<If> {

Pool state → offline → Error Page with Helpdesk-Support infos

}

<else> {

Pool state → disabled → simply maintenance site

}

Thanks

Have not tested but might work with something like this

of course adjust names, members and messages

when HTTP_REQUEST {
    if { [LB::status pool my_pool member 10.1.1.1 80] eq "down" &&
		[LB::status pool my_pool member 10.1.1.2 80] eq "down" }{
        HTTP::respond 200 content {
			<html>
				<head>
					<title>Error Page</title>
				</head>
				<body>
					whatever you want to say plus links
				</body>
			</html>
		}
    } elseif { [LB::status pool my_pool member 10.1.1.1 80] eq "session_disabled" &&
		[LB::status pool my_pool member 10.1.1.2 80] eq "session_disabled" }{
		HTTP::respond 200 content {
			<html>
				<head>
					<title>Maintenance Page</title>
				</head>
				<body>
					whatever you want to say
				</body>
			</html>
		}
	}
	else {
        pool my_pool
    }
}

Thank you. Working fine for me :slight_smile: