Forum Discussion
Is assigning virtual server through iRule throws exception if it is offline
If I try to assign a different virtual server based upon some condition, do I need to check the status of the virtual server before assigning, or it will automatically be taken care and in this case it will throw exception.
if {[catch {virtual $<virtualServerName>}]} {
log local0. "Error in assigning virtual server"
}
Does checking the virtual server associated pool status (Up/Down) will help in this case.
- cjunior
Nacreous
Hello,
I think you should care about exception if your variable don't have a valid virtual server name.
Once name exists, I can't see it throwing exceptions due to virtual server availability state.
You are trying to create a rule to only send traffic when destination virtual server is available? Is it?
Regards
- Maria123
Altostratus
Thanks for your reply , yes intention was to select the virtual server only when it is available.
So before selecting the virtual server checking the status of the virtual server associated default pool i.e. if active member is there make sense ? The pool is having only one virtual server.
- cjunior
Nacreous
Hi,
Yes, make sense, but as you have only a default pool to virtual server, you can check it instead of create a pool to a single virtual server as well.
Something like this:
when <EVENT_DESIRED> { if { <condition is true> } { if { [active_members <default_pool_from_virtual_server1>] > 0 } { virtual <virtual_server1_name> } else { virtual <virtual_server2_name> } } }
I hope it helps
Recent Discussions
Related Content
* 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