Forum Discussion

Jeff_47746's avatar
Jeff_47746
Icon for Nimbostratus rankNimbostratus
Oct 08, 2008

PowerShell NodeAddress.Get_Status

I am attempting to modify the PoolMemberControl script to run at the Node Level.

 

I have with the help of these forums and documentation figured out the Set_Session_Enabled_State and Set_Monitor_Status pieces.

 

 

However now I am attempting to use the Connection Bleed loop and I keep getting the following error. I know I am close... any help would be appreciated.

 

 

Unable to index into an object of type iControl.LocalLBNodeAddressNodeAddressStatistics.

 

At S:\Technology\Technical Services\Scripting Resources\iControl\Scripts\DisableNode.ps1:92 char:46

 

+ $MemberStatisticEntry = $MemberStatisticsA[0 <<<< ].statistics();

 

 

Here is my loop

 

 

$cur_connections = 1;

 

 

while ($cur_connections -gt 0)

 

{

 

$MemberStatisticsA =

 

(Get-F5.iControl).LocalLBNodeAddress.get_statistics($NodeAddresses);

 

 

$MemberStatisticEntry = $MemberStatisticsA[0].statistics();

 

$Statistics = $MemberStatisticEntry.statistics;

 

foreach ($Statistic in $Statistics)

 

{

 

$type = $Statistic.type;

 

$value = $Statistic.value;

 

 

if ($type -eq "STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS")

 

{

 

$cur_connections = $value.low;

 

Write-Host "Current Connections: $cur_connections"

 

}

 

}

 

Start-Sleep -s 1

 

}
  • I Figured out the syntax for this command. Thanks again for the immense amount of information in these forums.

     

     

    Updated Code:

     

     

    $cur_connections = 1;

     

     

    while ($cur_connections -gt 0)

     

    {

     

    $MemberStatisticsA = (Get-F5.iControl).LocalLBNodeAddress.get_statistics($NodeAddresses);

     

     

    $MemberStatisticEntry = $MemberStatisticsA.statistics;

     

    $Statistics = $MemberStatisticEntry[ 0 ].statistics;

     

     

    foreach ($Statistic in $Statistics)

     

    {

     

    $type = $Statistic.type;

     

    $value = $Statistic.value;

     

     

    if ($type -eq "STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS")

     

    {

     

    $cur_connections = $value.low;

     

    Write-Host "Current Connections: $cur_connections"

     

    }

     

    }

     

    Start-Sleep -s 1

     

    }
  • Glad to help! B-).

     

     

    Oh, and thanks for posting your solution so I didn't have to try to debug your first one. Feel free to post any and all powershell related questions as I'd be glad to help you out.

     

     

    -Joe