Forum Discussion
Virtual Server Scripting
If you're running 11.4 or above you could incorporate the new iControl REST API. Here's what that might look like with cURL:
Removing the access profile:
curl -sk -u admin:admin -X DELETE https://x.x.x.x/mgmt/tm/ltm/virtual/my_vs/profiles/my_access_profile
Adding the access profile:
curl -sk -u admin:admin -X POST https://x.x.x.x/mgmt/tm/ltm/virtual/my_vs/profiles -d '{"name":"my_access_profile"}' -H "Content-Type: application/json"
It'd be pretty straight forward to incorporate these REST calls into a Perl, Python, PowerShell, or Bash script.
You could also, alternatively, use a data group to manage maintenance. Something like this:
when HTTP_REQUEST {
if { [class match [virtual] equals maint_mode] } {
ACCESS::disable
pool maintmode_pool
}
}
where "maint_mode" is a string-based data group containing the names of virtual servers that you want to be in maintenance mode. Example:
ltm data-group internal maint_mode {
records {
/Common/my-vs1 { }
}
type string
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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