Forum Discussion
Scott_Jarboe_31
Nimbostratus
Mar 24, 2017PowerShell - Add Health Monitor to Pool
Hi there,
I am looking for the PowerShell way to do the following: 1. Go to Local Traffic > Pools > Select a Pool 2. Select "http" from "Available Health Monitors" 3. Press << to add the health monitor 4. Press "Update" to apply change.
I know how to go so far as to access the F5 and create the Node and Pool, but I'm not sure how to apply the health monitor to the pool.
Warm regards, Scott
1 Reply
Assuming you are using the iControl PowerShell cmdlet's, here's something that should get you going.
---------------------------------------------------------------------------- function Associate-MonitorWithPool() Description: This function will associate a monitor template with the specified pool. Parameters: PoolName - The Pool name to target. MonitorName - The Monitor Template name to associate with the given pool. ---------------------------------------------------------------------------- { param( [string]$PoolName, [string]$MonitorName ); $monitor_association = New-Object -TypeName iControl.LocalLBPoolMonitorAssociation; $monitor_association.pool_name = $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 = (, $MonitorName); $(Get-F5.iControl).LocalLBPool.set_monitor_association( (, $monitor_association) ); Write-Host "Monitor '$MonitorName' Is Associated With Pool '$PoolName'"; }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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