Forum Discussion

kittH_118525's avatar
kittH_118525
Icon for Nimbostratus rankNimbostratus
Feb 28, 2013

Determining primary device in HA cluster

Hello, I have several powershell scripts that perform operations and pull statistics from F5 using iControl. We have two devices in Active/Standby configuration, and I am having trouble determining which device I should connect to programmatically. Is there a class or property I can look at to determine which device is active?

 

2 Replies

  • You'll have to log into the device and get it's failover state:

     

     

    $failoverState = (Get-F5.iControl).SystemFailover.get_failover_state()

     

    if($failoverState -eq 'FAILOVER_STATE_ACTIVE')

     

    ..............

     

  • Thanks Tim, that worked perfectly.

     

    Here is how I ended up implementing it:

     

    While (!$F5Connection){

     

    $Credentials = Get-Credential -Message "Please enter F5 credentials"

     

    $F5Connection = Initialize-F5.iControl -HostName $F5Server -Credentials $Credentials}

     

    If((Get-F5.iControl).SystemFailover.get_failover_state() -eq 'FAILOVER_STATE_STANDBY'){Initialize-F5.iControl -HostName $F5Backup -Credentials $Credentials}