Forum Discussion
It is quite difficult to understand your requirements from the description.
If your application servers in the pool start throwing HTTP error 500 when they are down you can simply create a custom HTTP monitor which fails on receiveing status code 500(should be a Reverse monitor) and attach that to your pool in addition to the default HTTP monitor.
So now if one of your pool members start throwing error 500 it will be flagged down by the monitor and no further traffic will be sent to it until it comes back up.
If you have HTTP Profile attached to your virtual server you can use the "Fallback Host" setting to be the URL of your maintenance/sorry URL so when all pool members are down the users will be redirected to the fallback URL to see the nice "Sorry we are down for maintenance" page.
No need for any iRules for a simple set up.