Forum Discussion

jmeyercm_106295's avatar
jmeyercm_106295
Icon for Nimbostratus rankNimbostratus
Jan 24, 2011

Help with LocalLB PoolMember set_monitor_association

I'm running v.9.4.4 LTM and have a goal to automate the creation of all f5 objects in PowerShell. I found some helpful posts right here on devcentral that cover alot of what I need but there are still pieces I'm missing and need help to create.

 

 

 

In this post I would like to focus on how to associate a monitor with a specific pool member. I have a 1-to-1 monitor to member ratio since each monitor will use a unique host header in the send string. I'm including a Powershell function based on information found on devcentral which is close to what I'm looking for except it only associates the monitor at the pool level where I'm looking for association at the pool member. I see the icontrol functions exist but unsure what it should look like in PowerShell. Any help would be much appreciated.

 

 

 

----------------------------------------------------------------------------

 

function f5-AssociateMonitorWithPool()

 

 

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.

 

----------------------------------------------------------------------------

 

{

 

[CmdletBinding()]

 

PARAM

 

(

 

[Parameter(Mandatory=$true, HelpMessage="Pool Name", ValueFromPipeline=$true)][string]$PoolName,

 

[Parameter(Mandatory=$true, HelpMessage="Monitor Name", ValueFromPipeline=$true)][string]$MonitorName

 

)

 

PROCESS

 

{

 

$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'";

 

}

 

}

 

No RepliesBe the first to reply