Forum Discussion
Cloverleaf_5340
Nimbostratus
Jun 14, 2014DIsabling nodes in iControl REST shows related members as "up". How do you discover true state?
When disabling a node by PUTing the state to "user-down", the node goes down, and the GUI reflects this. Pool members of that node also show their state as down as well in the GUI (as you'd expect),...
Jun 16, 2014
Hi!
You can actually check it, but you need to check the enabled status for that.
Evaluate the following script (written in Powershell but the methods are the same):
Initialize Snapin
if ( (Get-PSSnapin | Where-Object { $_.Name -eq "iControlSnapIn"}) -eq $null ){
Add-PSSnapIn iControlSnapIn
}
Add a custom class with properties matching the object you got before
Add-Type @'
public class Member
{
public string Pool;
public string Address;
public string Port;
public string Name;
public string Availability;
public string Enabled;
public string Status;
}
'@
Function Get-Pool-Members {
Param([string]$BigIP, [string]$User, [string]$Password, [string]$Partition="Common")
Declare variables
$ObjMembers = @()
$NodeDict = @{}
Connect to the BigIP
$Success = Initialize-F5.iControl -HostName $BigIP -Username $User -Password $Password
Get an iControl Handle
$F5 = Get-F5.iControl
Change Partition
$F5.ManagementPartition.set_active_partition($Partition)
Get Pool Lists, statuses, nodes etc
$PoolList = $f5.LocalLBPool.get_list()
$Poolmembers = $f5.LocalLBPool.get_member_v2($PoolList)
$PoolMemberstatuses = $F5.LocalLBPool.get_member_object_status($PoolList, $Poolmembers)
$NodeList = $F5.LocalLBNodeAddressV2.get_list()
$NodeIPList = $f5.LocalLBNodeAddressV2.get_address($NodeList)
Save the nodes in a dictionary for convenient access
for($i=0;$i -lt ($NodeList.Count);$i++){
$NodeDict.Add($NodeList[$i], $NodeIPList[$i])
}
for($i=0;$i -lt ($PoolList.Count);$i++){
for($x=0;$x -lt ($PoolMembers[$i].Count);$x++){
Create a new temporary object of the member class
$objTempMember = New-Object Member
Populate the object
$objTempMember.Pool = $PoolList[$i]
$objTempMember.name = $PoolMembers[$i][$x].address
$objTempMember.Address = $NodeDict[$objTempMember.name]
$objTempMember.Port = $PoolMembers[$i][$x].port
$objTempMember.Availability = $PoolMemberstatuses[$i][$x].availability_status
$objTempMember.Enabled = $PoolMemberstatuses[$i][$x].enabled_status
$objTempMember.Status = $PoolMemberstatuses[$i][$x].status_description
Add the object to a list
$ObjMembers += $objTempMember
}
}
Return the object list
Return $ObjMembers
}
$poolmembers = Get-Pool-Members -BigIP "192.168.161.10" -User "iUser" -Password "mypassword" -Partition "Common"
This would generate the following output in my config:
Pool : /Common/SorryPool
Address : 192.168.174.1
Port : 8090
Name : /Common/PajoIIS
Availability : AVAILABILITY_STATUS_GREEN
Enabled : ENABLED_STATUS_DISABLED_BY_PARENT
Status : Pool member is available
Pool : /Common/allpool
Address : 192.168.174.1
Port : 8082
Name : /Common/PajoIIS
Availability : AVAILABILITY_STATUS_GREEN
Enabled : ENABLED_STATUS_DISABLED_BY_PARENT
Status : Pool member is available
Pool : /Common/PajoIIS-8080-8081_pool
Address : 192.168.174.1
Port : 8080
Name : /Common/PajoIIS
Availability : AVAILABILITY_STATUS_GREEN
Enabled : ENABLED_STATUS_DISABLED
Status : Pool member is available, user disabled
Pool : /Common/PajoIIS-8080-8081_pool
Address : 192.168.174.1
Port : 8081
Name : /Common/PajoIIS
Availability : AVAILABILITY_STATUS_GREEN
Enabled : ENABLED_STATUS_DISABLED_BY_PARENT
Status : Pool member is available
The key here would be this method:
https://devcentral.f5.com/wiki/iControl.LocalLB__Pool__get_member_object_status.ashx
Which would return an objectstatus object:
https://devcentral.f5.com/wiki/iControl.LocalLB__ObjectStatus.ashx
Hope that helped!
/Patrik
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