BIG-IP Report
Problem this snippet solves: Overview This is a script which will generate a report of the BIG-IP LTM configuration on all your load balancers making it easy to find information and get a comprehensive overview of virtual servers and pools connected to them. This information is used to relay information to NOC and developers to give them insight in where things are located and to be able to plan patching and deploys. I also use it myself as a quick way get information or gather data used as a foundation for RFC's, ie get a list of all external virtual servers without compression profiles. The script has been running on 13 pairs of load balancers, indexing over 1200 virtual servers for several years now and the report is widely used across the company and by many companies and governments across the world. It's easy to setup and use and only requires auditor (read-only) permissions on your devices. Demo/Preview Interactive demo http://loadbalancing.se/bigipreportdemo/ Screen shots The main report: The device overview: Certificate details: How to use this snippet: Installation instructions BigipReport REST This is the only branch we're updating since middle of 2020 and it supports 12.x and upwards (maybe even 11.6). Downloads (two latest versions): https://loadbalancing.se/downloads/bigipreport-v5.7.11.zip https://loadbalancing.se/downloads/bigipreport-v5.7.10.zip Documentation, installation instructions and troubleshooting:https://loadbalancing.se/bigipreport-rest/ Docker support https://loadbalancing.se/2021/01/05/running-bigipreport-on-docker/ Kubernetes support https://loadbalancing.se/2021/04/16/bigipreport-on-kubernetes/ BIG-IP Report (Legacy) Older version of the report that only runs on Windows and is depending on a Powershell plugin originally written by Joe Pruitt (F5) BIG-IP Report (only download this if you have v10 devices): https://loadbalancing.se/downloads/bigipreport-5.4.0-beta.zip iControl Snapin https://loadbalancing.se/downloads/f5-icontrol.zip Documentation and Installation Instructions https://loadbalancing.se/bigip-report/ Upgrade instructions Protect the report using APM and active directory Written by DevCentral member Shann_P: https://loadbalancing.se/2018/04/08/protecting-bigip-report-behind-an-apm-by-shannon-poole/ Got issues/problems/feedback? Still have issues? Drop a comment below. We usually reply quite fast. Any bugs found, issues detected or ideas contributed makes the report better for everyone, so it's always appreciated. --- Join us on Discord: https://discord.gg/7JJvPMYahA Code : BigIP Report Tested this on version: 12, 13, 14, 15, 1613KViews20likes94CommentsBigIP Report Old
Problem this snippet solves: This codeshare has been deprecated due to a hosting platform corruption. I have movedcode and conversation to a new record (on the same original URL) https://devcentral.f5.com/s/articles/bigip-report can be Overview This is a script which will generate a report of the BigIP LTM configuration on all your load balancers making it easy to find information and get a comprehensive overview of virtual servers and pools connected to them. This information is used to relay information to our NOC and developers to give them insight in where things are located and to be able to plan patching and deploys. I also use it myself as a quick way get information or gather data used as a foundation for RFC's, ie get a list of all external virtual servers without compression profiles. The script has been running on 13 pairs of load balancers, indexing over 1200 virtual servers for several years now and the report is widely used across the company and by many companies and governments across the world. It's easy to setup and use and only requires guest permissions on your devices. Demo/Preview Please note that it takes time to make these so sometimes they're a bit outdated and they only cover one HA pair. However, they still serve the purpose of showing what you can expect from the report. Interactive demo http://loadbalancing.se/bigipreportdemo/ Screen shots The main report: The device overview: Certificate details: How to use this snippet: This codeshare has been deprecated due to a hosting platform corruption. I have movedcode and conversation to a new record (on the same original URL) https://devcentral.f5.com/s/articles/bigip-report Installation instructions BigipReport REST This is the only branch we're updating since middle of 2020 and it supports 12.x and upwards (maybe even 11.6). Download:https://loadbalancing.se/downloads/bigipreport-v5.5.4.zip Documentation, installation instructions and troubleshooting:https://loadbalancing.se/bigipreport-rest/ Docker support This will be the recommended way of running bigipreport in the near future. It's still undergoing testing but it's looking really good so far. https://loadbalancing.se/2021/01/05/running-bigipreport-on-docker/ BigipReport (Legacy) Older version of the report that only runs on Windows and is depending on a Powershell plugin originally written by Joe Pruitt (F5). BigipReport (Stable): https://loadbalancing.se/downloads/bigipreport-5.3.1.zip BigipReport (BETA): https://loadbalancing.se/downloads/bigipreport-5.4.0-beta.zip iControl Snapin: https://loadbalancing.se/downloads/f5-icontrol.zip Documentation and installation instructions: https://loadbalancing.se/bigip-report/ Upgrade instructions Protect the report using APM and active directory Written by DevCentral member Shann_P: https://loadbalancing.se/2018/04/08/protecting-bigip-report-behind-an-apm-by-shannon-poole/ Got issues/problems/feedback? Still have issues? Drop a comment below. We usually reply quite fast. Any bugs found, issues detected or ideas contributed makes the report better for everyone, so it's always appreciated. --- Also trying out a Discord channel now. You're welcome to hang out with us there: https://discord.gg/7JJvPMYahA Code : 85931,86647,90730 Tested this on version: 13.026KViews16likes974CommentsGenerate private key w/ CSR via iControl REST
Problem this snippet solves: Generate a private key w/ CSR How to use this snippet: To create a private key with a CSR via iControl REST: POST URL:https://10.1.1.165/mgmt/tm/sys/crypto/key Use the data below as your payload. For the name field, it must end in .key or you will get a false 404! Code : { "name":"www.testing.com.key", "commonName":"www.testing.com", "keySize":"4096", "keyType":"rsa-private", "options":[{"gen-csr":"www.testing.com"}], "organization":"Let It Snow Corp.", "ou":"Ice Engineering", "city":"Calhoun", "state":"AZ", "admin-email-address":"jerry@letit.snow", "email-address":"beth@letit.snow", "subject-alternative-name":"DNS:www.testing.com", "challenge-password":"myP4ssword" } Tested this on version: 13.01.9KViews3likes11CommentsPerl Ltm Config To Xml/Excel (version 3.1)
Problem this snippet solves: This code is an improvement of "Perl Ltm Config To Xml (version 2)" published on previous DevCentral (https://devcentral.f5.com/s/articles/perl-ltm-config-to-xml-version-2-1009) queries the components of a virtual servers configuration and prints it out in an XML format. Is recursive through partitions and prints the following data: VS_name VS_IP: IP and port RD (route domain) VS_state: status (ex. green) and state (ex. enabled) Profiles: name, type, context. If SSL profile aditional info: certificate, chain, key, cipher list Persistence iRules: order and name Pool_name LB-method: method, minimum active members Member: name, IP, port, ratio, priority, status and state Monitors: name, interval, timeout. If HTTP/HTTPS monitors additional info: Send and Receive strings SNAT_name SNAT_members Has a new option "-s" or "-simplified" which outputs multiple values like the profile list or pool members into a unique XML field. Purpose of simplified mode is to be able to have one Virtual Server per row on Excel, with lists showing on a single cell. This code has been tested on BIG-IP version 12.1 and 14.1. How to use this snippet: Default mode: ./LTM-to-XML.pl bigip uid pwd > result.xml Example for simplified mode and removal of partition information: ./LTM-to-XML.pl -s 127.0.0.1 uid pwd | sed "s/\/.*app\///g" | sed "s/\/Common\///g" > result.xml The XML can be dragged and dropped on MS Excel and opened as an XML table. Code : (see ZIP file) Tested this on version: 12.1, 14.11KViews2likes3CommentsGo library to manage BIG-IP iControl REST API
Problem this snippet solves: This library provides necessary structs and functions to manage the whole REST API. Some REST Calls may require BIG-IP v12.1.x to work properly. How to use this snippet: f5-rest-client implements a REST client to query the F5 BIG-IP iControl REST API. Installation go get -u github.com/e-XpertSolutions/f5-rest-client/f5 Available authentication methods Basic authentication f5Client, err := f5.NewBasicClient(base_url, username, password) Token based authentication f5Client, err := f5.NewTokenClient(base_url, username, password, login_provider_name, skip_ssl_verification) Usage // Copyright 2017 e-Xpert Solutions SA. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "encoding/json" "log" "github.com/e-XpertSolutions/f5-rest-client/f5" "github.com/e-XpertSolutions/f5-rest-client/f5/net" ) func sexyPrint(label string, a interface{}) { j, err := json.MarshalIndent(a, "", " ") if err != nil { log.Fatal(err) } log.Print("DEBUG ", label, ":\n", string(j)) } func main() { // 1) Basic Authentication f5Client, err := f5.NewBasicClient("https://127.0.0.1", "admin", "admin") // 2) Token Based Authentication // f5Client, err := f5.NewTokenClient("https://127.0.0.1", "admin", "admin", "tmos", true) if err != nil { log.Fatal(err) } f5Client.DisableCertCheck() netClient := net.New(f5Client) self, err := netClient.Self().ListAll() if err != nil { log.Fatal(err) } sexyPrint("SelfIP List:", self) } FEATURES Basic authentication Token based authentication Manage Virtual Server, pool, node, irules, monitors Manage Cluster Management Manage interfaces, vlan, trunk, self ip, route, route domains Manage virtualization features (/vcmp) Manage system related stuffs Add Helper functions to enable, disable or force a node offline Add Helper functions to enable or disable a Virtual Server List expiring certificates List expired certificates Transaction support [new] Manage DNS and global load balancing servers (/gtm) [new] Add support for Stats retrieval on node, pool, virtual and profiles ROADMAP Add support for authentication through external providers Manage access policies (/apm) Manage security (/security) Manage analytics configuration (/analytics) Add support for results pagination Add support for API versioning Add support for new API endpoints coming in v13 Examples Transactions - Create a simple HTTP service f5Client, err := f5.NewBasicClient("https://127.0.0.1", "admin", "admin") if err != nil { log.Fatal(err) } f5Client.DisableCertCheck() // Start new transaction. tx, err := f5Client.Begin() if err != nil { log.Fatal(err) } ltmClient := ltm.New(tx) // Create a HTTP monitor log.Print("Create a HTTP monitor") monitorConfig := ltm.MonitorHTTPConfig{ Name: "http_monitor_" + tx.TransactionID(), Send: "GET / HTTP/1.0\r\n\r\n", Recv: "Hello", } if err := ltmClient.MonitorHTTP().Create(monitorConfig); err != nil { log.Fatal(err) } // Create a Pool log.Print("Create a pool") poolConfig := ltm.PoolConfig{ Name: "pool_" + tx.TransactionID(), Monitor: "/Common/http_monitor_" + tx.TransactionID(), Members: []string{"10.1.10.10:80", "10.1.10.11:80"}, } if err := ltmClient.Pool().Create(poolConfig); err != nil { log.Fatal(err) } // Create a Virtual Server log.Print("Create a Virtual Server") vsConfig := ltm.VirtualServerConfig{ Name: "vs_http_" + tx.TransactionID(), Destination: "10.1.20.130:80", IPProtocol: "tcp", Pool: "pool_" + tx.TransactionID(), SourceAddressTranslation: ltm.SourceAddressTranslation{ Type: "automap", }, Profiles: []string{ "tcp-mobile-optimized", "http", }, } if err := ltmClient.Virtual().Create(vsConfig); err != nil { log.Fatal(err) } // Commit to make the changes persistent. if err := tx.Commit(); err != nil { log.Fatal(err) } List SSL Certificates sysClient := sys.New(f5Client) certs, err := sysClient.FileSSLCert().ListAll() if err != nil { log.Fatal(err) } sexyPrint("Certificates", certs) List expired SSL Certificates sysClient := sys.New(f5Client) certs, err := sysClient.FileSSLCert().ListExpired() if err != nil { log.Fatal(err) } sexyPrint("Expired Certificates", certs) List expiring SSL Certificates sysClient := sys.New(f5Client) // ListExpiring(number_of_seconds) certs, err := sysClient.FileSSLCert().ListExpiring(60 * 60 * 24 * 15) if err != nil { log.Fatal(err) } sexyPrint("Expiring Certificates", certs) Contributing We appreciate any form of contribution (feature request, bug report, pull request, ...). We have no special requirements for Pull Request, just follow the standard GitHub way. License The sources are release under a BSD 3-Clause License. The full terms of that license can be found in LICENSE file of this repository. Code : https://github.com/e-XpertSolutions/f5-rest-client Tested this on version: 11.51.3KViews1like3CommentsNode/Pool/VIP Creation Script (from csv input)
Problem this snippet solves: We deploy huge numbers of servers on a biweekly basis and need to create VIPs for groupings of them to load balance. this is a script i put together to ease that task. Fill out the 4 CSV sheets for Nodes, Pools, VIPs, and profiles for the VIPs. Run script, specify the IP of your BIG-IP and away it goes. Currently working with F5 support to allow blank values in profile import from csv, they provided an example that worked to leave blanks but also inputs none for values with an actual setting. Code : <# F5 Script Author: Will Longo Design & Build - Clinical #> #load Snapin if ( (Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"}) -eq $null ){ Add-PSSnapIn iControlSnapIn} Function Browse(){ [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |Out-Null [System.Windows.Forms.Application]::EnableVisualStyles() $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog $OpenFileDialog.initialDirectory = (get-location).path $OpenFileDialog.filter = "CSV (*.csv)|*.csv|All files (*.*)|*.*" $loop = $true while($loop) { if ($OpenFileDialog.ShowDialog() -eq "OK") { $loop = $false } else { $res = [System.Windows.Forms.MessageBox]::Show("You clicked Cancel. Try again or return to main form?", "Choose a directory", [System.Windows.Forms.MessageBoxButtons]::RetryCancel) if($res -eq "Cancel") { #End script return } } } $OpenFileDialog.filename } Function ConfigSave{ $saveyn = read-host "Do you wish to sync your configuration? (Y/N)" if($saveyn -eq "Y"){(Get-F5.iControl).SystemConfigSync.synchronize_configuration(1)} else{write-host "Completed";return;} } Function VIP{ $vipINFILE = Import-Csv $vipCSV foreach ($vipset in $vipINFILE | Where-object {$_.Sequence -eq $i}) { $vipdefinition = New-Object -TypeName iControl.CommonVirtualServerDefinition; $vipdefinition.name = $vipset.VIPName; $vipdefinition.address = $vipset.VIPIP; $vipdefinition.port = $vipset.VIPPort; $vipdefinition.protocol = $vipset.Protocol; $vipdefinitions = (, $vipdefinition); $wildmasks = (, "255.255.255.255"); $resource = New-Object -TypeName iControl.LocalLBVirtualServerVirtualServerResource; $resource.type = "RESOURCE_TYPE_POOL"; $resource.default_pool_name = $poolset.PoolName; $resources = (, $resource); $vippersistence = New-object -TypeName iControl.LocalLBVirtualServerVirtualServerPersistence; $vippersistence.profile_name = $vipset.vippersistence $vippersistence.default_profile = $null $profileINFILE = import-csv $profileCSV foreach ($profileset in $profileINFILE | where-object {$_.Sequence -eq $i}) { $vipprofilehttp = New-Object -TypeName iControl.LocalLBVirtualServerVirtualServerProfile; $vipprofilehttp.profile_context = "PROFILE_CONTEXT_TYPE_ALL"; $vipprofilehttp.profile_name = $profileset.http; $vipprofilessl = New-Object -TypeName iControl.LocalLBVirtualServerVirtualServerProfile; $vipprofilessl.profile_context = "PROFILE_CONTEXT_TYPE_CLIENT"; $vipprofilessl.profile_name = $profileset.SSLClient; $vipprofileoneconnect = New-Object -TypeName iControl.LocalLBVirtualServerVirtualServerProfile; $vipprofileoneconnect.profile_context = "PROFILE_CONTEXT_TYPE_ALL"; $vipprofileoneconnect.profile_name = $profileset.OneConnect; } $vipprofileA = ($vipprofilehttp, $vipprofilessl, $vipprofileoneconnect); $vipprofileAofA = (, $vipprofileA); (Get-F5.iControl).LocalLBVirtualServer.create($vipdefinitions,$wildmasks,$resources,$vipprofileAofA) if($vipset.snat -eq "AutoMAP"){(Get-F5.iControl).LocalLBVirtualServer.set_snat_automap((, $vipset.VIPName))} (Get-F5.iControl).LocalLBVirtualServer.Add_persistence_profile((,$vipset.VIPName),(,$vippersistence)) write-host $vipset.VIPName " created..." } } Function Pool{ $poolINFILE = Import-Csv $poolCSV foreach ($poolset in $poolINFILE | where-object {$_.Sequence -eq $i}) { if($poolset.LoadBalanceMethod -eq "Round Robin"){$LBMethod = "LB_METHOD_ROUND_ROBIN"} elseif($poolset.LoadBalanceMethod -eq "Observed (member)"){$LBMethod = "LB_METHOD_OBSERVED_MEMBER"} elseif($poolset.LoadBalanceMethod -eq "Least Connections (member)"){$LBMethod = "LB_METHOD_LEAST_CONNECTION_MEMBER"} elseif($poolset.LoadBalanceMethod -eq "Ratio (member)"){$LBMethod = "LB_METHOD_RATIO_MEMBER"} elseif($poolset.LoadBalanceMethod -eq "Predictive (member)"){$LBMethod = "LB_METHOD_PREDICTIVE_MEMBER"} else{Write-Host "Unknown Load Balance Method"} $jPPortDefList = New-Object -TypeName iControl.CommonIPPortDefinition[] $MemberList.Length; for($j=0; $j -lt $MemberList.Length; $j++) { $jPPortDefList[$j] = New-Object -TypeName iControl.CommonIPPortDefinition; $jPPortDefList[$j].address = $MemberList[$j]; $jPPortDefList[$j].port = $poolset.MemberPort; } (Get-F5.iControl).LocalLBPool.create( (,$poolset.PoolName), (,$LBMethod), (,$jPPortDefList)) $monitor_association = New-Object -TypeName iControl.LocalLBPoolMonitorAssociation; $monitor_association.pool_name = $poolset.PoolName; $monitor_association.monitor_rule = New-Object -TypeName iControl.LocalLBMonitorRule; $monitor_association.monitor_rule.type = "MONITOR_RULE_TYPE_SINGLE"; $monitor_association.monitor_rule.quorum = 0; $monitor_association.monitor_rule.monitor_templates = (, $poolset.PoolHealthMonitor); (Get-F5.iControl).LocalLBPool.set_monitor_association((, $monitor_association)) write-host $poolset.PoolName " created..." VIP; } } Function Node{ $nodeINFILE = Import-Csv $nodeCSV foreach ($nodeset in $nodeINFILE) { (Get-F5.iControl).LocalLBNodeAddress.create( (,$nodeset.NodeIP), (,0) ) (Get-F5.iControl).LocalLBNodeAddress.set_screen_name( (,$nodeset.NodeIP), (,$nodeset.NodeName ) ) $nodeaddress = New-Object -TypeName iControl.LocalLBMonitorIP; $nodeaddress.address_type = "ATYPE_STAR_ADDRESS" $nodeaddress.ipaddress = $nodeset.NodeIP $monitor_association2 = New-Object -TypeName iControl.LocalLBNodeAddressMonitorAssociation; $monitor_association2.node_Address = $nodeaddress $monitor_association2.monitor_rule = New-Object -TypeName iControl.LocalLBMonitorRule; $monitor_association2.monitor_rule.type = "MONITOR_RULE_TYPE_SINGLE"; $monitor_association2.monitor_rule.quorum = 0; $monitor_association2.monitor_rule.monitor_templates = (, $nodeset.HealthMonitor); (Get-F5.iControl).LocalLBNodeAddress.Set_Monitor_Association((,$monitor_association2)) write-host $nodeset.NodeName " created..." } $i=1 $ilimiter=read-host "How many Pools are you creating? (Enter a value)" while($i -le $ilimiter) { foreach ($poolmember in $nodeINFILE | where-object {$_.Sequence -eq $i}) { [array]$memberlist += $poolmember.NodeIP } Pool; Remove-variable memberlist $i++ } ConfigSave; } #Start $BigIP = read-host "What is the IP of your F5 Big-IP Device" #connect Initialize-F5.iControl -HostName $Bigip -Credentials (Get-Credential); $host.ui.RawUI.WindowTitle = "Will's F5 Script - Node" $actorpass = (Get-F5.iControl).SystemFailover.get_failover_state() if($actorpass -ne "FAILOVER_STATE_ACTIVE"){write-host "This is not the Active F5, Please re-run this script" -ForegroundColor Yellow -BackgroundColor Red;return} #INPUT write-host "select your Node CSV" $nodeCSV = Browse write-host "select your Pool CSV" $poolCSV = Browse write-host "select your VIP CSV" $vipCSV = Browse write-host "select your Profiles CSV" $profileCSV = Browse if (!$nodecsv){$cancel=$true} if (!$poolcsv){$cancel=$true} if (!$vipcsv){$cancel=$true} if (!$profilecsv){$cancel=$true} if ($cancel){write-host "Cancelled by User!" -ForegroundColor Yellow -BackgroundColor Red;return} #start Node;890Views1like2CommentsPowerShell PoolMember Ratio And Priority
Problem this snippet solves: This sample PowerShell script illustrates how to use the methods in the LocalLB::Pool interface to get and set the Ratio and Priority for a Pool Member. Note, this example uses the new pool member methods in the LocalLB Pool interface introduced in BIG-IP v11.0 Code : #---------------------------------------------------------------------------- # The contents of this file are subject to the "END USER LICENSE AGREEMENT # FOR F5 Software Development Kit for iControl"; you may not use this file # except in compliance with the License. The License is included in the # iControl Software Development Kit. # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. # # The Original Code is iControl Code and related documentation # distributed by F5. # # The Initial Developer of the Original Code is F5 Networks, Inc. # Seattle, WA, USA. Portions created by F5 are Copyright (C) 1996-2012 # F5 Networks, Inc. All Rights Reserved. iControl (TM) is a registered # trademark of F5 Networks, Inc. # # Alternatively, the contents of this file may be used under the terms # of the GNU General Public License (the "GPL"), in which case the # provisions of GPL are applicable instead of those above. If you wish # to allow use of your version of this file only under the terms of the # GPL and not to allow others to use your version of this file under the # License, indicate your decision by deleting the provisions above and # replace them with the notice and other provisions required by the GPL. # If you do not delete the provisions above, a recipient may use your # version of this file under either the License or the GPL. #---------------------------------------------------------------------------- param ( $BIGIP = $null, $User = $null, $Pass = $null, $Pool = $null, $Member = $null, $Ratio = $null, $Priority = $null ) #------------------------------------------------------------------------- # function Show-Usage #------------------------------------------------------------------------- function Show-Usage() { Write-Host @" Usage: PoolMemberRatioPriority.ps1 BIGIP User Pass Pool Member Ratio Priority Examples .\PoolMemberRatioPriority.ps1 -BIGIP bigip -User user -Pass pass : list pools .\PoolMemberRatioPriority.ps1 -BIGIP bigip -User user -Pass pass -Member ipport : list pool members .\PoolMemberRatioPriority.ps1 -BIGIP bigip -User user -Pass pass -Member ipport -Ratio 5 : set member ratio to 5 .\PoolMemberRatioPriority.ps1 -BIGIP bigip -User user -Pass pass -Member ipport -Priority 3 : set member priority to 3 "@ exit; } #---------------------------------------------------------------------------- function Do-Initialize() #---------------------------------------------------------------------------- { if ( (Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"}) -eq $null ) { Add-PSSnapIn iControlSnapIn } $success = Initialize-F5.iControl -HostName $BIGIP -Username $User -Password $Pass; return $success; } function Parse-AddressPort() { param($Value); $tokens = $Value.Split(":"); $r = New-Object iControl.CommonAddressPort; $r.address = $tokens[0]; $r.port = $tokens[1]; $r; } function Get-Pools() { (Get-F5.iControl).LocalLBPool.get_list(); } function Get-PoolMembers() { param( $Pool = $null ); $MemberListAofA = (Get-F5.iControl).LocalLBPool.get_member_v2( @($Pool) ); $MemberListA = $MemberListAofA[0]; $MemberListA; } function Get-PoolMemberDetails() { param( $Pool = $null, $Member = $null ); $AddrPort = Parse-AddressPort $Member; $RatioAofA = (Get-F5.iControl).LocalLBPool.get_member_ratio( @($Pool), @( @($AddrPort) ) ); $PriorityAofA = (Get-F5.iControl).LocalLBPool.get_member_priority( @($Pool), @( @($AddrPort) ) ); $ratio = $RatioAofA[0][0]; $priority = $PriorityAofA[0][0]; "Pool '$Pool' member '$Member' ratio '$ratio' priority '$priority'"; } function Set-PoolMemberDetails() { param( $Pool = $null, $Member = $null, $Ratio = $null, $Priority = $null ); $AddrPort = Parse-AddressPort $Member; if ( $null -ne $Ratio ) { (Get-F5.iControl).LocalLBPool.set_member_ratio( @($Pool), @( @($AddrPort) ), @($Ratio) ); } if ( $null -ne $Priority ) { (Get-F5.iControl).LocalLBPool.set_member_priority( @($Pool), @( @($AddrPort) ), @($Priority) ); } } #------------------------------------------------------------------------- # Main Application Logic #------------------------------------------------------------------------- if ( ($BIGIP -eq $null) -or ($User -eq $null) -or ($Pass -eq $null) ) { Show-Usage; } if ( Do-Initialize ) { if ( $Pool -eq $null ) { # List Pools Get-Pools; } elseif ( $Member -eq $null ) { # List Pool Members Get-PoolMembers -Pool $Pool; } elseif ( ($Ratio -eq $null) -and ($Priority -eq $null) ) { # List Pool Member Details Get-PoolMemberDetails -Pool $Pool -Member $Member; } else { # Set Ratio and/or Priority Set-PoolMemberDetails -Pool $Pool -Member $Member -Ratio $Ratio -Priority $Priority; Get-PoolMemberDetails -Pool $Pool -Member $Member; } } else { Write-Error "ERROR: iControl subsystem not initialized" }282Views1like1Comment