Forum Discussion
Mike_Maher
Nimbostratus
Jul 02, 2010Switching Classes on ASM based on pool availability
I have an ASM with no LTM license, currently it is setup that traffic comes into the VS and is sent to a class based on Host, then run through ASM policy and sent to a pool which contains a node for an internal pool on an LTM. We have created 2 pools per host one for each Data Center. We use DNS internally to control which DC the traffic is sent to, but since ASM is based on IP only and can't use DNS, whenever we fail from one DC to another I must go in and manually repoint the class to the active pool.
So I am trying to craft an iRule on the ASM that can handle this automatically. One thought I had was to create 2 classes one for each DC for each host and them use the iRule to check the pool availability and send to the appropriate class based on that, or perhaps find a way to change the pool that the class is pointed to based on pool availability.
I have gotten this so far I am just trying to figure out if I can assign 2 http classes to a VS that will both match on the traffic and then let this iRule sort out who gets the traffic, also I assume I will have to set a default pool in the VS as well for this to work. Any thoughts or sample code would be appreciated. Thanks
when HTTP_REQUEST {
if { [active_members [LB::server pool]] < 1
HTTP::class select $anotherHttpClass
else
HTTP::class select $anotherHttpClass
}
}
- Chris_Miller
Altostratus
Your iRule should always take priority so I don't see a problem with having two classes (or none for that matter) attached to your VS. If you don't want to use a default pool, you should be able to specify the pool within the iRule as well.Using what you have above: when HTTP_REQUEST { if { [active_members [LB::server pool]] } { < 1 HTTP::class select $anotherHttpClass pool server pool } else { HTTP::class select $anotherHttpClass pool another pool } }
- Mike_Maher
Nimbostratus
Chris - Chris_Miller
Altostratus
Posted By Mike Maher on 07/02/2010 11:18 AM - hoolio
Cirrostratus
The HTTP class selected with HTTP::class in an iRule does need to be associated with the VS or you'll get a runtime error when the rule is executed. You can use an iRule to override the HTTP class selection done by LTM, but you'll need to do this in the HTTP_CLASS_SELECTED event (and possibly HTTP_CLASS_FAILED if there is a chance a request might not match any HTTP class).when CLIENT_ACCEPTED { Save default pool name set default_pool [LB::server pool] } when HTTP_CLASS_SELECTED { if { [active_members $default_pool] > 0 } { pool $default_pool } else { pool alternate_pool } }
- Mike_Maher
Nimbostratus
Aaron, - hoolio
Cirrostratus
Hi Mike,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects